PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Tuesday, January 25, 2022

[FIXED] No session variables show up in view - Laravel 5.1

 January 25, 2022     laravel-5.1, php, session, view     No comments   

Issue

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>{{ $error }}</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?


Solution

To anyone that has this problem, how I solved it was changing the .env file from SESSION_DRIVER=array to SESSION_DRIVER=file



Answered By - Haring10
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home
View mobile version

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing