Home >Backend Development >PHP Tutorial >Questions about multiple middlewares in laravel
When I checked the source code in tipask, I found that I didn’t understand the routing definition very well. I asked my friends:
This is the routing code:
<code class="PHP">Route::Group(['prefix'=>'admin','namespace'=>'Admin','middleware' =>['auth','auth.admin']],function(){</code>
Here is a question:
Does the multiple middleware definitions in laravel mean that we have to go through the two middlewares 'auth' and 'auth.admin' here? Does it enter the second 'auth.admin' middleware after the middleware 'auth' is satisfied, or are both audited at the same time? still?
I’m a little confused, I hope you guys can give me some advice.
When I checked the source code in tipask, I found that I didn’t understand the routing definition very well. I asked my friends:
This is the routing code:
<code class="PHP">Route::Group(['prefix'=>'admin','namespace'=>'Admin','middleware' =>['auth','auth.admin']],function(){</code>
Here is a question:
Does the multiple middleware definitions in laravel mean that we have to go through the two middlewares 'auth' and 'auth.admin' here? Does it enter the second 'auth.admin' middleware after the middleware 'auth' is satisfied, or are both audited at the same time? still?
I’m a little confused, I hope you guys can give me some advice.
Well, it needs to go through two middlewares.
Laravel implements the pipeline mechanism, that is, the output of the previous middleware is the input of the next middleware. So it is executed sequentially.