@@ 7-15 (lines=9) @@ | ||
4 | ||
5 | trait HasRoles |
|
6 | { |
|
7 | public function hasRole($role) |
|
8 | { |
|
9 | $roles = config('simple_roles.roles'); |
|
10 | if (!array_key_exists($role, $roles)) { |
|
11 | throw new Exception("Role doesn't exist"); |
|
12 | } |
|
13 | ||
14 | return $this->role == $roles[$role]; |
|
15 | } |
|
16 | ||
17 | public function setRole($role) |
|
18 | { |
|
@@ 17-25 (lines=9) @@ | ||
14 | return $this->role == $roles[$role]; |
|
15 | } |
|
16 | ||
17 | public function setRole($role) |
|
18 | { |
|
19 | $roles = config('simple_roles.roles'); |
|
20 | if (!array_key_exists($role, $roles)) { |
|
21 | throw new Exception("Role doesn't exist"); |
|
22 | } |
|
23 | ||
24 | $this->role = $roles[$role]; |
|
25 | } |
|
26 | ||
27 | public function removeRole() |
|
28 | { |