Defining in the routes.php if the method (the function in the class) needs authentication seems good. In that way we stop the request before it reaches the controller, but how is it done?
In the example in: https://laravel.com/docs/5.3/authentication#protecting-routes we see
Route::get('profile', function () { // Only authenticated users may enter... })->middleware('auth');
What if I want anyone to be able to see the index-method and only show the method extendedInfo to logged in users? Route::get('profile', function () { FreeForAll->ProfileController@index, Middleware-Auth->ProfileController@extendedInfo, });
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community