Laravel查看分享不会工作

时间:2017-12-28 15:29:12

标签: php laravel-5 blade

我有以下课程

use Illuminate\Support\Facades\View;


class WebUser

{


    public function __construct()
    {

        $status = (object) [
            'isLogin' => (Session::get('token')? true : false),
            'isSubscribed' => $this->isSubscribed(),
            'isPlatinum' => $this->isPlatinum(),
            'isExpired' => $this->isExpired()
        ];

        View::share('thisUser',$status);

    }

此类将在用户成功登录后运行。

我尝试在视图文件{{$ thisUser}}中查看共享变量,给出错误

Undefined variable: thisUser (View: 

0 个答案:

没有答案