A LoginMiddleware class is defined, and the handle method defines rules that only allow intranet user methods. When all the routes now follow this rule, what should I do if I only want some routes to follow this rule? Thank you for defining a LoginMiddleware class. The handle method defines rules that only allow intranet user methods. Now all routes follow this rule, what should I do if I only want some routes to follow this rule?
Thank you.
Reply content:
A LoginMiddleware class is defined, and the handle method defines rules that only allow intranet user methods. When all the routes now follow this rule, what should I do if I only want some routes to follow this rule?
Thank you.
First, you mustApp/Kernel. php
Under$ RouteMiddleware
This route is registered in the array. Note that$ RouteMiddleware
Instead$ Middleware
.
InApp/routes. php
DefineGroup
To apply a middleware to this group, as shown below:
Route: group (['ddleware '=> 'auth'], function (){//...});