简体   繁体   English

Laravel FrozenNode Auth :: check()总是返回False

[英]Laravel FrozenNode Auth::check() always return False

Laravell 5.2 and FrozenNode/Laravel-Administrator 5.0.11 . Laravell 5.2FrozenNode/Laravel-Administrator 5.0.11

Try to use: 尝试使用:

'domain' => '',
'middleware' => array(),
   'permission'=> function()
        {
            return Auth::check();
        }

in config/administrator.php , but always get "False" . config/administrator.php ,但总是得到"False" In other places returns "True" . 在其他地方返回"True"

The problem is that the admin routes provided by FrozenNode are not inside the web middleware group, therefore they do not include any of the session information. 问题是FrozenNode提供的管理路由不在web中间件组内,因此它们不包含任何会话信息。 No session, no logged in user. 没有会话,没有登录用户。

You can easily fix this, however, by adding 'web' to the middleware key in your config file: 但是,您可以通过在配置文件中的middleware密钥中添加'web'来轻松解决此问题:

'domain' => '',
'middleware' => array('web'), // add 'web' middleware group
'permission'=> function() {
    return Auth::check();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM