How to get session data from service providers in laravel?

I am developing a Laravel project. I am using Laravel 5.1. In my project, I share data in all views in the upload method appServiceProvider.

function boot()
{
    $items = $this->itemRepo->getItems(session("key"));
    view()->share('items', array('items'=>$items));
}

But the value of the session is always zero. I have seen many articles on the Internet. But they did not work. So please, how can I convey my session value?

+4
source share
1 answer

, Laravel 5 , , , , . , HTTP- .

, .

+1

Source: https://habr.com/ru/post/1622623/


All Articles