Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kaliceo's avatar

Session not working

Hi there, I'm facing some issues with session. After login in and redirecting to the homepage, my session isn't working. If I do dd((Auth::check()) before redirecting, session is ok but I do this after redirecting session is not working at all. Here is some parts of my code: Route:

Route::get('/', function()
{
    return View::make('accueil');
});
Route::controller('users', 'UsersController');
Users controller
public function postLogin() {
    if (Auth::check()) {
        Session::flash('message', 'Vous êtes déjà connecté.');
        return Redirect::to('/');
    }
    $user = array(
        'pseudo' => Input::get('pseudo'),
        'password' => Input::get('password')
    );
    if (Auth::attempt($user)) {
        /*Session::flash('message', 'Vous êtes connecté.');*/
        return Redirect::to('/');
    } else {
        Session::flash('message', 'Vos identifiants ne sont pas corrects.');
        return Redirect::back();
    }
}

Thanks in advance and sorry if i'm doing some mistakes, english isn't my native language

0 likes
1 reply
Snapey's avatar

because of recent changes with the handling of web middleware it's really difficult to know if you are suffering from no web middleware or in fact double web middleware.

Do php artisan route:list and post the result here. check the middleware column. you should have just one instance of web on each route.

Please or to participate in this conversation.