Friday, March 31, 2017

Laravel 5.2, sessions, 404 page conflict

I had a problem with 404 page that it didn't save session status: 404 page doesn't save data

The problem has been solved, but new appeared. After success delete, update or create, im returning notification, something like this:

if ($this->model->fill($data)->save()) {
    return ['status' => 'The product has been added'];
}

and showing it in the page:

@if (session('error'))
    <div class="alert alert-danger">
        
    </div>
@endif

but when these 2 lines

\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class

are present in kernel, these notification doesn't exists in session

Is it possible to make it work together: status notification and session in 404 page?



via Batmannn

Advertisement