我已经为的每个请求创建了一个应该运行的中间件,所以我将它添加到Http\Kernel的$middleware属性中。我也在这个中间件中使用了Auth::check(),所以我的中间件应该在 Auth中间件之后运行Auth,除非Auth::check()不能工作,我应该怎么做呢?
发布于 2016-06-29 21:04:45
据我所知,你已经这么做了。
您应该将代码放入Auth::check()语句中,如下所示:
<?php namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class Test
{
public function handle($request, Closure $next)
{
if (Auth::check()) {
// your logic here
}
return $next($request);
}
}https://stackoverflow.com/questions/38109008
复制相似问题