I bring up to date: if the order id comes to the route - I try to get it from the database. If it is not in the database, I try to get the order data from the session. All this magic happens in RouteServiceProvider :: boot:
$router->model('order', 'App\Order', function ($id) { return new \App\Order(['order' => $id]); }); However, when I try to get data from the session in the closure, like this:
Session::all() I get an empty array. However, by the controller action the session data is available. And in the template, respectively, are also available.
An option in each controller action to fill in the data with an empty model smacks of a crutch. Can someone suggest a solution?
Laravel 5.2.35. Session settings - by default, I have not changed them.