Friday, March 31, 2017

Session doesn't save value with redirect-> "with" method laravel 5.2

When I put data like this:

$request->session()->put('123', '12345')

, session contains this value, but when I try to put data into session this way

$result = ['status' => 'Product has been updated']
return redirect('/admin/products/')->with($result);

Session doesn't contains it.

kernel:

protected $middleware = [
        \Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode::class,
         \Illuminate\Session\Middleware\StartSession::class,
         \Illuminate\View\Middleware\ShareErrorsFromSession::class
    ];

routes:

Route::group(['prefix' => 'admin', 'middleware' => 'auth'], function () {
    Route::get('/', ['uses' => 'Admin\IndexController@index', 'as' => 'adminIndex']);
    Route::resource('/products', 'Admin\ProductController');
});

I have red about changes in laravel 5.2 and that this problem may cause web middleware but i haven't it in my routes. Why session doesn't contain given status then?



via Batmannn

Advertisement