When you create a controller, https://laravel.com does provide you with the route resource which provides out of the box CRUD operation routes. You can check these named routes by the following command: php artisan route:list By default, following is the list of the photos controller CRUD operation routes: Verb Action Route Name /photos index photos.index /photos/create index photos.index /photos index photos.index /photos/{photo} index photos.index /photos/{photo}/edit index photos.index /photos index photos.index /photos index photos.index Sometimes, we may want to use only few of the routes from the CRUD operation and let's say we want to use only index, create, store, edit and update, we can customise it like the following: Route::resource('photos', 'PhotoController')->only('index', 'create', 'store', 'edit', 'update'); We can also specify the as option to define a prefix for every route name. Route::resource('photos', 'PhotoController', [ 'as' => 'foo' ]); Similarly, you can also provide a custom name for each controller methods like the following: Route::resource('photos', 'PhotoController', [ 'names' => [ 'index' => 'foo', 'store' => 'foo.new', // etc... ]]);
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners