You could always use the only or except options for the actions you won't use and Laravel won't generate routes for those: https://laravel.com/docs/master/controllers#restful-partial-resource-routes
Should I use resource route if I only use ~3 resourceful methods in the controller?
Is it advisable to use Route::resource if I use only create, update, destroy methods in the controller?
In my application I got quite a few helper lists / tables, where records are often created / updated / deleted through JavaScript on some random page. In those cases, I don't use the index, edit, show methods.
It does make the web.php route file shorter when using Route::resource. That's been the main reason I been doing that.
From what I understand, when I run php artisan optimize command, routes will be added into one long array, so it is quicker during request endpoint lookup.
The downside could be that the route's array may contain endpoints which are never used.
In my current project I have 350 - 400 endpoints.
Should I be concerned about the un-used endpoints in the route array, or am I over thinking it 🤔
@guntarv It’s just a method on the router. You can use it in any route files but yes, it’s intention is to be used for API routes defined in an api.php file.
Please or to participate in this conversation.