mod mediaController
This commit is contained in:
parent
00592aca0e
commit
d429b8959b
|
@ -45,10 +45,12 @@ class MediaController
|
||||||
|
|
||||||
$medias = collect($content)->map(function ($c) use ($collection, $model) {
|
$medias = collect($content)->map(function ($c) use ($collection, $model) {
|
||||||
$pathinfo = pathinfo($c['name']);
|
$pathinfo = pathinfo($c['name']);
|
||||||
$path = $collection->runCallback('forceFileName', $model, $pathinfo['filename']).'.'.$pathinfo['extension'];
|
$basename = $collection->runCallback('forceFileName', $model, $pathinfo['filename']);
|
||||||
Storage::disk('public')->put($path, base64_decode($c['content']));
|
$path = $basename.'.'.$pathinfo['extension'];
|
||||||
$adder = $model
|
$adder = $model
|
||||||
->addMedia(Storage::disk('public')->path($path))
|
->addMediaFromBase64($c['content'])
|
||||||
|
->usingName($basename)
|
||||||
|
->usingFileName($path)
|
||||||
->withCustomProperties($collection->runCallback('withDefaultProperties', $path));
|
->withCustomProperties($collection->runCallback('withDefaultProperties', $path));
|
||||||
|
|
||||||
return tap(
|
return tap(
|
||||||
|
|
Loading…
Reference in New Issue