Skip to content

Commit 9fb5af7

Browse files
authored
Add permissions attribute
1 parent d2e26e0 commit 9fb5af7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/Traits/Governable.php

+7
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,11 @@ public function getIsSuperAdminAttribute() : bool
2424

2525
return $this->roles->contains($superAdminRole->name);
2626
}
27+
28+
public function getPermissionsAttribute() : Collection
29+
{
30+
$roleNames = $this->roles->pluck('name');
31+
32+
return (new Permission)->whereIn('role_key', $roleNames)->get();
33+
}
2734
}

0 commit comments

Comments
 (0)