1 | <?php namespace Anomaly\UsersModule\Role; |
||
14 | class RoleModel extends UsersRolesEntryModel implements RoleInterface |
||
15 | { |
||
16 | |||
17 | /** |
||
18 | * The cache minutes. |
||
19 | * |
||
20 | * @var int |
||
21 | */ |
||
22 | protected $ttl = 99999; |
||
23 | |||
24 | /** |
||
25 | * Eager loaded relations. |
||
26 | * |
||
27 | * @var array |
||
28 | */ |
||
29 | protected $with = [ |
||
30 | 'translations', |
||
31 | ]; |
||
32 | |||
33 | /** |
||
34 | * Get the role slug. |
||
35 | * |
||
36 | * @return string |
||
37 | */ |
||
38 | public function getSlug() |
||
39 | { |
||
40 | return $this->slug; |
||
41 | } |
||
42 | |||
43 | /** |
||
44 | * Get the role name. |
||
45 | * |
||
46 | * @return string |
||
47 | */ |
||
48 | public function getName() |
||
52 | |||
53 | /** |
||
54 | * Get the role's permissions. |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | public function getPermissions() |
||
62 | |||
63 | /** |
||
64 | * Return if a role as access to a the permission. |
||
65 | * |
||
66 | * @param string $permission |
||
67 | * @return mixed |
||
68 | */ |
||
69 | public function hasPermission($permission) |
||
85 | |||
86 | /** |
||
87 | * Get the related users. |
||
88 | * |
||
89 | * @return UserCollection |
||
90 | */ |
||
91 | public function getUsers() |
||
95 | |||
96 | /** |
||
97 | * Return the users relation. |
||
98 | * |
||
99 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
100 | */ |
||
101 | public function users() |
||
110 | } |
||
111 |