阅读(4926) (9)

Laravel 8 指定看守器

2021-06-29 15:28:25 更新

当你把 auth 中间件添加到路由中时,同时也能指定使用哪个看守器进行用户认证。指定的看守器应该对应 auth.php 配置文件中 guards 数组中的的一个键:

public function __construct()
{
    $this->middleware('auth:api');
}