samedi 13 août 2016

Laravel 5.1 - adding middleware in a route replacing controller method with closure

I am setting middleware property in my routes. I am hoping to handle the login in the middleware so that by the time the control reaches the controller method, I will have the user data will be available. In the routes.php file I have added the following statement.

Route::get('users/find',['middleware'=>'jwt.auth','UsersController@show'])->name('users.find');

I was hoping that the above statement will make the route point to

UsersController@show

, but it is pointing to a Closure when i checked using route:list command. Please advice on how to make the route point to the controller method. It was behaving as expected when there was no middleware.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire