I have a restful route controller for user setup like this:
Route::resource('user', 'UserController');
I am able to use the auth middleware in the UserController like this:
public function __construct()
{
$this->middleware('auth');
}
But how can I apply a different middleware (or both) to the edit, update and destroy routes as $this->middleware('auth') cannot be used inside a function?
Have you not tried adding additional route method to the Route::resource and creating or adding another middleware?
I think you can add additional Routes to Resource controllers, example below,
Route::get('photos/popular');
Route::resource('photos', 'PhotoController');
check the documentation, http://laravel.com/docs/5.0/controllers
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community