Reputation: 10135
I want to create some resourcesful routes but yet restrict some methods so they don't show up as routes.
This could be such a resourceful route:
Route::resource('users', 'UsersController');
And I remember there was a method to restrict these resourceful routes like this:
Route::resource('users', ['uses' => 'UsersController', 'except' => ['store', 'delete']]);
Yet when I do something like this I get an
[ErrorException] Array to string conversion
How do I restrict resourcesful routes in Laravel 5, without typing each route manually?
Upvotes: 3
Views: 1066
Reputation: 12127
You are using the wrong syntax.
Route::resource('users', 'UsersController', [
'except' => ['store', 'delete']
]);
It is very clear in the docs under Customizing Resource Routes.
Upvotes: 5