Ad

Auth::user Is Not Preserved On Redirect

After I updated from laravel 5.1 to 5.2 I got this unexpected problem. I use Auth::login to manually login the user. And when I redirect user is not preserved.

All the config was gracefully ported from from clear laravel 5.2 installation.

Here's the routes code:

Route::group([ 'middleware' => [ 'web' ] ], function () {
    Route::get('test', function () {
        $user = \Upping\Models\User::find(311);
        Auth::login($user);
        Auth::check(); // true
        return redirect('authCheck');
    });

    Route::get('authCheck', function () {
        Auth::check(); // false
    });
});

config\auth.php -> providers

'users' => [
    'driver' => 'eloquent',
    'model' => \Upping\Models\User::class,
],

Speaking of laravel experience, tiny hint should be enough for me. And thanks for helping out.

Ad

Answer

So the real cause was a bit far-fetched. I read error logs and figured it was Zend Z-ray and its laravel plugin being mean to 5.2 update.

After i turned the thing off everything began to operate properly.

Ad
source: stackoverflow.com
Ad