K
K
kostya17042021-09-26 17:08:05
Laravel
kostya1704, 2021-09-26 17:08:05

How to access session from service provider in laravel?

How to access session from service provider in laravel?
Get the $orders variable in the header.
There is a session in the files, but in the AppServiceProvider
dd(session('item')) = null.

public function boot()
    {
    $orders = Order::where('id',session('item'))->first();
         View::share([
       'orders'=> $orders,
        ]);
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question