diff --git a/resources/views/common/companies/edit.blade.php b/resources/views/common/companies/edit.blade.php index 18c0e3210..cce9dd218 100644 --- a/resources/views/common/companies/edit.blade.php +++ b/resources/views/common/companies/edit.blade.php @@ -32,7 +32,7 @@ {{ Form::textareaGroup('address', trans('general.address')) }} - {{ Form::fileGroup('logo', trans('companies.logo'), '', ['dropzone-class' => 'form-file']) }} + {{ Form::fileGroup('logo', trans('companies.logo'), '', ['dropzone-class' => 'form-file'], $company->company_logo) }} {{ Form::radioGroup('enabled', trans('general.enabled'), $company->enabled) }} diff --git a/resources/views/common/items/edit.blade.php b/resources/views/common/items/edit.blade.php index a4ba4ee02..9c79991b1 100644 --- a/resources/views/common/items/edit.blade.php +++ b/resources/views/common/items/edit.blade.php @@ -30,7 +30,7 @@ {{ Form::selectRemoteAddNewGroup('category_id', trans_choice('general.categories', 1), 'folder', $categories, $item->category_id, ['path' => route('modals.categories.create') . '?type=item', 'remote_action' => route('categories.index'). '?search=type:item']) }} - {{ Form::fileGroup('picture', trans_choice('general.pictures', 1), '', ['dropzone-class' => 'form-file']) }} + {{ Form::fileGroup('picture', trans_choice('general.pictures', 1), '', ['dropzone-class' => 'form-file'], $item->picture) }} {{ Form::radioGroup('enabled', trans('general.enabled'), $item->enabled) }} diff --git a/resources/views/partials/form/file_group.blade.php b/resources/views/partials/form/file_group.blade.php index 14cd4d836..7591b9a36 100644 --- a/resources/views/partials/form/file_group.blade.php +++ b/resources/views/partials/form/file_group.blade.php @@ -37,20 +37,35 @@ @endif @if (!empty($value)) + @php + $attachments = []; + @endphp + @if (is_array($value)) @foreach($value as $attachment) @php - $attachments[] = ['name' => $attachment->filename . '.' . $attachment->extension, 'path' => route('uploads.get', $attachment->id), 'downloadPath' => route('uploads.download', $attachment->id)]; + $attachments[] = [ + 'name' => $attachment->filename . '.' . $attachment->extension, + 'path' => route('uploads.get', $attachment->id), + 'downloadPath' => route('uploads.download', $attachment->id) + ]; @endphp @endforeach @elseif ($value instanceof \Plank\Mediable\Media) @php - $attachments = ['name' => $value->filename . '.' . $value->extension, 'path' => route('uploads.get', $value->id)]; - $attachments = array($attachments); + $attachments[] = [ + 'name' => $value->filename . '.' . $value->extension, + 'path' => route('uploads.get', $value->id) + ]; @endphp @else @php - $attachments = array(); + $attachment = \Plank\Mediable\Media::find($value); + + $attachments[] = [ + 'name' => $attachment->filename . '.' . $attachment->extension, + 'path' => route('uploads.get', $attachment->id) + ]; @endphp @endif