How to restrict resourceful routes in Laravel
I want to create some resource intensive routes, but will still restrict some of the methods so they don't show up as routes.
It could be a resourceful route like this:
Route::resource('users', 'UsersController');
And I remember that there is a way to restrict these resourceful routes like this:
Route::resource('users', ['uses' => 'UsersController', 'except' => ['store', 'delete']]);
But when I do something like this I get
[ErrorException] Convert array to string
How to limit resources to resources in Laravel 5 without manually entering each route?
+3
source to share
1 answer
You are using the wrong syntax.
Route::resource('users', 'UsersController', [
'except' => ['store', 'delete']
]);
Very clear in the docs under Configuring Resource Routes .
+5
source to share