Skip to content

Commit

Permalink
Add role_name attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
amiryousefi authored Apr 11, 2021
1 parent 26b43fc commit 1c9dc1c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Traits/HasRoles.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public function role()
{
return $this->belongsTo(Role::class);
}

public function getRoleNameAttribute(){
return $this->role()->first() ? $this->role()->first()->name : null ;
}
}

0 comments on commit 1c9dc1c

Please sign in to comment.