Skip to content

Commit

Permalink
close #2707 Fixed: Failed to update Vendor ( #3qec06f )
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Oct 31, 2022
1 parent 185becf commit 3552cf1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions app/Traits/Uploads.php
Expand Up @@ -14,7 +14,7 @@ public function getMedia($file, $folder = 'settings', $company_id = null)
{
$path = '';

if (!$file || !$file->isValid()) {
if (! $file || ! $file->isValid()) {
return $path;
}

Expand All @@ -38,7 +38,7 @@ public function importMedia($file, $folder = 'settings', $company_id = null, $di
{
$path = '';

if (!$disk) {
if (! $disk) {
$disk = config('mediable.default_disk');
}

Expand All @@ -61,10 +61,18 @@ public function deleteMediaModel($model, $parameter, $request = null)
return;
}

$multiple = true;

if ($medias instanceof \App\Models\Common\Media) {
$multiple = false;

$medias = [$medias];
}

$already_uploaded = [];

if ($request && isset($request['uploaded_' . $parameter])) {
$uploaded = $request['uploaded_' . $parameter];
$uploaded = ($multiple) ? $request['uploaded_' . $parameter] : [$request['uploaded_' . $parameter]];

if (count($medias) == count($uploaded)) {
return;
Expand Down

0 comments on commit 3552cf1

Please sign in to comment.