I'm staring blind at a supposingly easy issue. I have defined the following routes in my web.php file.
Route::resource('objects', 'ObjectController');
Route::get('objects/grid','ObjectController@grid')->name('objects.grid');
This results in the following list of routes:
MACBOOKPRO:laravel-test user$ php artisan route:list
+--------+-----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
| | GET|HEAD | objects | objects.index | App\Http\Controllers\ObjectController@index | web |
| | POST | objects | objects.store | App\Http\Controllers\ObjectController@store | web |
| | GET|HEAD | objects/create | objects.create | App\Http\Controllers\ObjectController@create | web |
| | GET|HEAD | objects/grid | objects.grid | App\Http\Controllers\ObjectController@grid | web |
| | DELETE | objects/{object} | objects.destroy | App\Http\Controllers\ObjectController@destroy | web |
| | GET|HEAD | objects/{object} | objects.show | App\Http\Controllers\ObjectController@show | web |
| | PUT|PATCH | objects/{object} | objects.update | App\Http\Controllers\ObjectController@update | web |
| | GET|HEAD | objects/{object}/edit | objects.edit | App\Http\Controllers\ObjectController@edit | web |
+--------+-----------+------------------------+------------------+------------------------------------------------------------------------+--------------+
Going to http://localhost:8000/objects/grid does always return a 404 page. So there must be a conflict with other routes. If I change the 'objects/grid' to 'object/grid' and then it works.
A second pair of eyes is welcome here.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire