mardi 19 avril 2016

No session variables show up in view - Laravel 5.1

I am trying to display errors on my login page using the Session::flash() method in Laravel 5.1.

In my view I am using:

@if($errors->has())
    <div class="alert alert-danger">
        @foreach ($errors->all() as $error)
            <div></div>
        @endforeach
    </div>
@endif

And in my controller:

return Redirect::route('login')->withErrors($validator)->withInput();

  1. I am not getting anything from the Input::old() method when getting redirected with errors to this page.

  2. The $errors variable is empty on the reload.

If I dd($validator); right before the return Redirect::route..., the $validator has data in it:

enter image description here

But when the page loads, nothing happens.

I can try Session::put but still, nothing happens when getting the view.

What could be wrong? Is there maybe something in composer or php artisan that may be able to reset this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire