mod mediaController

This commit is contained in:
Philipp Lang 2023-03-08 15:42:34 +01:00
parent 00592aca0e
commit d429b8959b
1 changed files with 5 additions and 3 deletions

View File

@ -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(