laravel / nova-issues

553 stars 34 forks source link

Image field: cannot delete or update image anymore #2375

Closed preliot closed 4 years ago

preliot commented 4 years ago

Description:

Although this used to work, now i am unable to delete or upload an image with the image field. I get errors in my browser console only:

Delete image: /nova-api/client-shops/20/field/image 404 (Not Found)

Upload image: POST /nova-api/client-shops/20?viaResource=&viaResourceId=&viaRelationship=&editing=true&editMode=update 422 (Unprocessable Entity)

(Note i've replaced by url with )

Recreate issue

  1. config/filesystems.php
    'disks' => [
        'public' => [
            'driver' => 'local',
            'root' => storage_path('app/public'),
            'url' => env('APP_URL') . '/storage',
            'visibility' => 'public',
        ],
  2. php artisan storage:link
  3. create nova resource with Image field
 Fields\Image::make(ucfirst(__('my-image')), 'image')
            ->disk('public');

Already tried

  1. Delete and recreate symlink
  2. Check filepath
  3. Debug. When i delete an image, line 28 of Laravel\Nova\Http\Controllers\FieldDestroyController.php aborts my attempt:
//my delete attempt will end in the abort(404)
$field = $resource->updateFields($request)
                    ->whereInstanceOf(File::class)
                    ->findFieldByAttribute($request->field, function () {
                        abort(404);
                    });
cgarofalo commented 4 years ago

I have a similar issue where I cannot update/delete images with the Nova images field. Laravel 5.8.36 Nova 2.9.4 PHP 7.2.16

davidhemphill commented 4 years ago

I was not able to reproduce this using your setup on a fresh Nova instance. Image uploading and deletion seems to be working normally. If you can find a way to reproduce this using a fresh Nova install in a fresh Laravel app, please open a new issue. Thanks!

preliot commented 4 years ago

Issue was due to package Eminiarts\Tabs\TabsOnEdit. Similar to issue https://github.com/eminiarts/nova-tabs/issues/28

AlexAzartsev commented 4 years ago

is any way to fix this and keep nova-tabs?