mercredi 7 septembre 2016

\Auth::user() is null in 5.3.6?

This is about Laravel 5.3.6

I am able to login successfully and I can check Auth User after login. I can show the exact location where Auth::guard() has current user object. Below are the details.

  1. Go to Login Controller
  2. Go to AuthenticatesUsers Trait
  3. Go to sendLoginResponse method. User reaches here successfully because user is authenticated successfully.

here I can check $this->guard()->user() has current user value. But when control reaches to Role controller....I tried to access it like this dd(Auth::guard()); and value was null. I also added reference below in Role Controller.

use Illuminate\Support\Facades\Auth;

Below is my route for Role Controller.

Route::group(['middleware' => ['auth']], function () {
    Route::get('/Roles',              
        array (
            'uses'  => 'Website\Role\RoleController@index',      
            'as'    => 'Roles'
        )
    );
});

Did you face this kind of issue in Laravel 5.3.6?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire