outl1ne / nova-settings

A Laravel Nova tool for editing custom settings using native Nova fields.
MIT License
274 stars 96 forks source link

404 Not Found nova-api/nova-settings/settings/field/{fieldName} #8

Closed ifaniqbal closed 4 years ago

ifaniqbal commented 4 years ago

This is weird. Already run php artisan optimize and check the route via php artisan route:list | grep nova-settings I can confirm route exists. But, this error still happen when I try to delete image.

Any suggestion?

ifaniqbal commented 4 years ago

This happen on v1.4, Laravel 6.10, Nova 2.9.

ifaniqbal commented 4 years ago

Nevermind, my bad. I had to run these commands to solve this issue:

php artisan route:clear
php artisan config:clear
php artisan cache:clear
php artisan view:clear

I thought php artisan optimize alone is enough.

ifaniqbal commented 4 years ago

But wait, when I run php artisan optimize again, the error occurs. Seems that the route not getting cached.

ifaniqbal commented 4 years ago

The result of php artisan route:list shows that this route: DELETE | nova-api/nova-settings/settings/field/{fieldName}

is mentioned first before this route: DELETE | nova-api/{resource}/{resourceId}/field/{field}

Meanwhile, these two routes: POST | nova-vendor/nova-settings/settings GET|HEAD | nova-vendor/nova-settings/settings

are mentioned after nova-api routes.

Could it be the problem?

ifaniqbal commented 4 years ago

To make it work, I had to manually add the route to my routes/web.php:

Route::delete('nova-api/nova-settings/settings/field/{fieldName}', '\OptimistDigital\NovaSettings\Http\Controllers\SettingsController@deleteImage');

Tarpsvo commented 4 years ago

Hey! Sorry for the late reply, I was on vacation for the week.

You're exactly right. The issue is that when the routes are cached, the nova-api/nova-settings/settings/field/{fieldName} route from nova-settings is put before the Nova actual routes, which causes it to be overwritten. I'm looking into how I can fix this right now.

Tarpsvo commented 4 years ago

Hey! I released version 2.0.2 with a fix. Let me know if it works for you now. :)

ifaniqbal commented 4 years ago

It works! Thank you very much 👍