jeudi 28 décembre 2017

Laravel view share wont work

I have the following class

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);

    }

This class will run after user is successfully signed in.

I tried to view the shared variable in view file , giving error

Undefined variable: thisUser (View: 



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire