Laravel PHP Developer Question:

Download Job Interview Questions and Answers PDF

Explain me how to assign multiple middleware to Laravel route ?

Laravel PHP Developer Interview Question
Laravel PHP Developer Interview Question

Answer:

You 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 () {
//
});

Download Laravel PHP Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Tell me how To Set Database Connection In Laravel?What is Composer in Laravel PHP?