vendredi 28 avril 2017

Laravel 5 JWTAuth to check the user role is admin or not

when front-end parse a token to back-end, how to use JwtAuth to check the user relationship(role) that is a admin (role=1) or normal (role=0) ?

any idea?

The relationship with user and role

User

public function role()
{
   return $this->hasOne('FACI\Entity\User\Role','user_id','id');
}

Role

protected $fillable = ['user_id','role'];

public function user()
{
    return $this->belongsTo('FACI\Entity\User','user_id','id');
}



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2oPuQvu
via IFTTT

Aucun commentaire:

Enregistrer un commentaire