Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews Web Developer Interviews:BootstrapFront End Web DeveloperHTML DeveloperHybrid Application DeveloperInternee PHP DeveloperJnr PHP/Codeigniter DeveloperJunior Developer PHPLaravel PHP DeveloperPython DeveloperRuby DeveloperTypographyWeb Developer & DesignerWeb Developer Cum SEO AnalystWeb Development NinjasWebsite DeveloperWordPress Themes Developer
Copyright © 2018. All Rights Reserved
Laravel PHP Developer Interview Question:
Explain me how to assign multiple middleware to Laravel route ?
Submitted by: MuhammadYou can assign multiple middleware to Laravel route by using middleware method.
Example
// Assign multiple multiple middleware to Laravel to specific route
Route::get('/', function () {
//
})->middleware('firstMiddleware', 'secondMiddleware');
// Assign multiple multiple middleware to Laravel to route groups
Route::group(['middleware' => ['firstMiddleware','secondMiddleware']], function () {
//
});
Submitted by: Muhammad
Example
// Assign multiple multiple middleware to Laravel to specific route
Route::get('/', function () {
//
})->middleware('firstMiddleware', 'secondMiddleware');
// Assign multiple multiple middleware to Laravel to route groups
Route::group(['middleware' => ['firstMiddleware','secondMiddleware']], function () {
//
});
Submitted by: Muhammad
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.