Home > Backend Development > PHP Tutorial > Questions about multiple middlewares in laravel

Questions about multiple middlewares in laravel

WBOY
Release: 2016-09-15 11:30:56
Original
1211 people have browsed it

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>
Copy after login
Copy after login

Here is a question:

  1. 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.

Reply content:

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>
Copy after login
Copy after login

Here is a question:

  1. 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.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template