samedi 28 septembre 2019

laravel 5.8 Auth::user null after verified authentication

I've upgraded a laravel 5.4 to 5.8 project and added in some vue files vs blades and noticed that at some point along the way Auth::user() started to return null.

I reset all Auth files to laravel default from a fresh project, still returns null. I checked config files for auth and session variables per other post suggestions, no resolution. I can successfully Log::debug out that the AuthenticatesUsers.php 'authenticated' method logs out the Auth::user() successfully. When I move to another route from /login, i.e /browse, logging out Auth::user() immediately returns null.

I've php artisan cleared cache, config, and routes, run composer dump-autoload. My User model has all necessary traits and the DB uses 'id' as primary key. I can't figure out why I'm losing authentication immediately after logging in.

web.php:

Auth::routes();

Route::group(['middleware' => ['web']], function () {
    Route::get('/home', 'HomeController@index')->name('home');
    Route::get('/browse', 'ListingController@index')->name('listings');
});


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire