Laravel authentication, I can't retrieve the logged in user Laravel authentication, I can't retrieve the logged in user laravel laravel

Laravel authentication, I can't retrieve the logged in user


Make sure that all your routes are included in the same "route group" and "prefix"

route::get('/','myController@myAuthMethod'); /* this will not show your user because its an independent route  */route::group(['prefix'=>member,'Middleware'=>yourMiddleware],function(){route::get('a','AuthController@getLogin');route::get('b','AuthController@getLogout');route::post('c','AuthController@postRegister');route::get('d','AuthController@getRegister');route::get('e','Clubs@delete');route::get('f','Clubs@details');route::get('g','Clubs@listofclubs ');           /* a,b,c,d,e,f and g views will show your authenticated user */});


Make sure you register the login routes with the web middleware:

Route::group(['middleware' => ['web']], function () {    //your routes here});


Use 'auth' middleware on your route. And you will be able to retrieve logged in user.