Answer Posted / amit khanna
Middleware can also be assigned to controller’s route or within your controller’s constructor and it can be used with controller also..
You can use the middleware method to assign middleware to the controller.
The registered middleware can also be restricted to certain method of the controller.
Assigning Middleware to Route
Route::get('profile', [
'middleware' => 'auth',
'uses' => 'UserController@showProfile'
]);
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
How to enable query log in laravel?
How can we configure a mail-in laravel?
What are laravel eloquent?
How do I test sending emails without actually sending emails to real addresses?
What is homestead.yaml?
How to check an input value is present or not in laravel?
List out common artisan commands used in laravel.
How many types of middleware are there in laravel?
What is name of first file that loaded in laravel?
How do I register a service provider?
What is the use of in laravel?
How can we check the logged-in user info in laravel?
What is fillable attribute in a model?
How do you define middleware?
What is fillable in laravel model?