laravel5.1使用entrust实现权限管理遇到的问题?
laravel5.1使用entrust实现权限管理遇到的问题。
public function handle($request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
} else {
if (!$this->auth->user()->can(Route::getCurrentRoute()->getPath())) {
if ($request->ajax() || $request->wantsJson()) {
return response('您没有该操作权限', 403);
} else {
return response()->view('errors.403');
}
}
view()->share('menuData', $this->getMenu());
return $next($request);
}
}
始终提示没有权限,求教!
if (!$this->auth->user()->can(Route::getCurrentRoute()->getPath())) {
if ($request->ajax() || $request->wantsJson()) {
return response('您没有该操作权限', 403);
} else {
return response()->view('errors.403');
}
}
始终会进入到403,我已经给admin赋予了所有权限.
1 Comment
已解决!!!