Friday, March 31, 2017

Laravel Auth::user()->role always return null

I am using laravel 5.4, I want to get role from authenticated user So that i am calling auth()->user()->role in blade template and it always return null

i've add relation to user model, like this:

public function role()
{
    return $this->hasMany(UserRole::class, 'user_id');
}

anyone know how to solve it?



via brobrobrobrobro

Advertisement