1
I’ve done this several times but for some reason now it’s not working, I can’t grab the flash from the view session
Userscontroller:
public function login_page(Request $request) {
    $title = "login";
    $dataToView = array(
        "title" => $title,
    );
    return view('layouts/user_login', $dataToView);
}
public function doLogin(Request $request) {
    $credentials = array(
        'email' => $request->input('email'),
        'password' => $request->input('password'),
    );
    if(!Auth::attempt($credentials)) {
        Session::flash('flash_error', 'Something went wrong with your login');
        return redirect(Session::get('lang'). '/user/login');
    }
    Session::flash('flash_success', 'You have logged in successfully ' .Auth::user()->name);
    return redirect(Session::get('lang'). '/user/login');
}
user_login.blade.php
div id="content">
<form method="POST" action="{{url($varNavBar['langLink']. '/user/login')}}">
    {!! csrf_field() !!}
    <div>
        Email
        <input type="email" name="email" value="{{ old('email') }}">
    </div>
    <div>
        Password
        <input type="password" name="password" id="password">
    </div>
    <div>
        <input type="checkbox" name="remember"> Remember Me
    </div>
    <div>
        <button type="submit">Login</button>
    </div>
</form>
@if(Session::has('flash_success'))
    <div class="alert alert-success">
        <b>{{Session::get('flash_success')}}</b>
    </div>
@elseif(Session::has('flash_error'))
    <div class="alert alert-danger">
        <b>{{Session::get('flash_error')}}</b>
    </div>
@endif
Routes:
Route::get('en/user/login', 'UsersController@login_page');
Route::post('en/user/login', 'UsersController@doLogin');
I can fix this with Session::set... and Session::pull.... But I’d like to know why I’m not getting the flash in the view
I think it might be your route interfering with this.
– Diego Souza