E
E
elailasou2016-07-21 13:10:40
Sessions
elailasou, 2016-07-21 13:10:40

How in Laravel 5.1 will save data to session from Exception Handler?

Hey! Please help, can anyone come across, the problem is the following (Laravel 5.1):
I'm trying to change the behavior when throwing TokenMismatchException in this way: in Exceptions/Handler.php:

public function render($request, Exception $e)
    {
        if ($e instanceof TokenMismatchException){
            session()->put('put', 'qwe');
            return redirect()->route('test1')->with('with', 'sad');
        }
        return parent::render($request, $e);
    }

Everything would be fine, but the variables in the session are not saved when moving along the route.
In Laravel 5.2, variables are stored in the session.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nazar Mokrinsky, 2016-07-21
@nazarpc

So there was a bug in Laravel, it was fixed. Update to 5.2 or see changelog from 5.1 to 5.2 and fork or offer a backport in 5.1.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question