为什么文中中间件还没在 web.php 里面分配就可以直接用了!?
文中提到用中间件在UsersController里面使用construct方法直接开始使用了:
class UsersController extends Controller
{
public function __construct()
{
$this->middleware('auth', [
'except' => ['show', 'create', 'store']
]);
}
.
.
.
}
但基于并未在web.php里面用->middleware('auth');方法分配这个auth中间件,为什么就可以直接使用啦?
推荐文章: