1. Save directory between parts: App/http/middleware
2. Custom middleware:
(1) PHP artisan make:middleware [namemiddleware]//Generate in-between class templates
(2) in the App/http/middleware class in open creation, the handle method implements its own logic. //parameter one is the request, parameter two is the next middleware, can add other required parameters to parameter two.
(3) After writing its processing logic on the return $next ($request), it indicates that the middleware executes after the request, and vice versa after the request.
(4) Register middleware (make Effective): in the Routemiddleware array of the file app\http\kernel.php, add its own key value between the pieces.
(5) The second parameter in the route specifies the middleware to be used, [' middleware ' = ' + ' Middleware 1: parameters, middleware two ... ']
The use of Laravel middleware