Laravel 5, View::Share

前端 未结 5 820
闹比i
闹比i 2021-01-02 14:27

I\'m trying to do a view::share(\'current_user\', Auth::User()); but in laravel 5 i can\'t find where to do this, in L4 you could do this in the baseController,

5条回答
  •  轮回少年
    2021-01-02 14:52

    In Laravel 5 uses the same method as in laravel 4:

    View::share('current_user', Auth::User());
    

    or using the view helper:

    view()->share('current_user', Auth::User());
    

    See in http://laravel.com/docs/5.0/views

提交回复
热议问题