Skip to content

Commit 1c9dc1c

Browse files
authored
Add role_name attribute
1 parent 26b43fc commit 1c9dc1c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Traits/HasRoles.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ public function role()
1010
{
1111
return $this->belongsTo(Role::class);
1212
}
13+
14+
public function getRoleNameAttribute(){
15+
return $this->role()->first() ? $this->role()->first()->name : null ;
16+
}
1317
}

0 commit comments

Comments
 (0)