1 | <?php namespace Arcanedev\LaravelAuth\Models; |
||
23 | class PermissionsGroup extends Model implements PermissionsGroupContract |
||
24 | { |
||
25 | /* ------------------------------------------------------------------------------------------------ |
||
26 | | Properties |
||
27 | | ------------------------------------------------------------------------------------------------ |
||
28 | */ |
||
29 | /** |
||
30 | * The attributes that are mass assignable. |
||
31 | * |
||
32 | * @var array |
||
33 | */ |
||
34 | protected $fillable = ['name', 'slug', 'description']; |
||
35 | |||
36 | /* ------------------------------------------------------------------------------------------------ |
||
37 | | Constructor |
||
38 | | ------------------------------------------------------------------------------------------------ |
||
39 | */ |
||
40 | /** |
||
41 | * Create a new Eloquent model instance. |
||
42 | * |
||
43 | * @param array $attributes |
||
44 | */ |
||
45 | public function __construct(array $attributes = []) |
||
53 | 528 | ||
54 | /* ------------------------------------------------------------------------------------------------ |
||
55 | 528 | | Relationships |
|
56 | 528 | | ------------------------------------------------------------------------------------------------ |
|
57 | */ |
||
58 | /** |
||
59 | * Permissions Groups has many permissions. |
||
60 | * |
||
61 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
62 | */ |
||
63 | public function permissions() |
||
70 | |||
71 | /* ------------------------------------------------------------------------------------------------ |
||
72 | | Getters & Setters |
||
73 | | ------------------------------------------------------------------------------------------------ |
||
74 | */ |
||
75 | /** |
||
76 | * Set the name attribute. |
||
77 | * |
||
78 | * @param string $name |
||
79 | */ |
||
80 | public function setNameAttribute($name) |
||
85 | 104 | ||
86 | /** |
||
87 | * Set the slug attribute. |
||
88 | * |
||
89 | * @param string $slug |
||
90 | */ |
||
91 | public function setSlugAttribute($slug) |
||
95 | 104 | ||
96 | /* ------------------------------------------------------------------------------------------------ |
||
97 | | CRUD Functions |
||
98 | | ------------------------------------------------------------------------------------------------ |
||
99 | */ |
||
100 | /** |
||
101 | * Create and attach a permission. |
||
102 | * |
||
103 | * @param array $attributes |
||
104 | * @param bool $reload |
||
105 | */ |
||
106 | public function createPermission(array $attributes, $reload = true) |
||
112 | 16 | ||
113 | /** |
||
114 | * Attach the permission to a group. |
||
115 | * |
||
116 | * @param \Arcanesoft\Contracts\Auth\Models\Permission $permission |
||
117 | * @param bool $reload |
||
118 | */ |
||
119 | public function attachPermission(&$permission, $reload = true) |
||
128 | 48 | ||
129 | 48 | /** |
|
130 | * Attach the permission by id to a group. |
||
131 | * |
||
132 | * @param int $id |
||
133 | * @param bool $reload |
||
134 | * |
||
135 | * @return \Arcanesoft\Contracts\Auth\Models\Permission |
||
136 | */ |
||
137 | public function attachPermissionById($id, $reload = true) |
||
146 | |||
147 | 8 | /** |
|
148 | * Attach a collection of permissions to the group. |
||
149 | * |
||
150 | * @param \Illuminate\Database\Eloquent\Collection|array $permissions |
||
151 | * @param bool $reload |
||
152 | * |
||
153 | * @return \Illuminate\Database\Eloquent\Collection|array |
||
154 | */ |
||
155 | public function attachPermissions($permissions, $reload = true) |
||
163 | |||
164 | 24 | /** |
|
165 | * Attach the permission from a group. |
||
166 | * |
||
167 | * @param \Arcanesoft\Contracts\Auth\Models\Permission $permission |
||
168 | * @param bool $reload |
||
169 | */ |
||
170 | public function detachPermission(&$permission, $reload = true) |
||
180 | 24 | ||
181 | 24 | /** |
|
182 | 18 | * Attach the permission by id to a group. |
|
183 | * |
||
184 | 24 | * @param int $id |
|
185 | 24 | * @param bool $reload |
|
186 | * |
||
187 | * @return \Arcanesoft\Contracts\Auth\Models\Permission |
||
188 | */ |
||
189 | public function detachPermissionById($id, $reload = true) |
||
198 | |||
199 | 8 | /** |
|
200 | 8 | * Detach multiple permissions by ids. |
|
201 | 6 | * |
|
202 | * @param array $ids |
||
203 | 8 | * @param bool $reload |
|
204 | * |
||
205 | * @return int |
||
206 | */ |
||
207 | public function detachPermissions(array $ids, $reload = true) |
||
215 | |||
216 | 8 | /** |
|
217 | * Detach all permissions from the group. |
||
218 | 8 | * |
|
219 | * @param bool $reload |
||
220 | 8 | * |
|
221 | * @return int |
||
222 | 8 | */ |
|
223 | public function detachAllPermissions($reload = true) |
||
231 | |||
232 | 16 | /* ------------------------------------------------------------------------------------------------ |
|
233 | | Check Functions |
||
234 | 16 | | ------------------------------------------------------------------------------------------------ |
|
235 | */ |
||
236 | 16 | /** |
|
237 | * Check if role has the given permission (Permission Model or Id). |
||
238 | 16 | * |
|
239 | * @param \Arcanesoft\Contracts\Auth\Models\Permission|int $id |
||
240 | 16 | * |
|
241 | * @return bool |
||
242 | */ |
||
243 | public function hasPermission($id) |
||
250 | |||
251 | /* ------------------------------------------------------------------------------------------------ |
||
252 | | Other Functions |
||
253 | | ------------------------------------------------------------------------------------------------ |
||
254 | 64 | */ |
|
255 | /** |
||
256 | 64 | * Get a permission from the group. |
|
257 | 64 | * |
|
258 | 48 | * @param \Arcanesoft\Contracts\Auth\Models\Permission|int $id |
|
259 | * |
||
260 | 64 | * @return \Arcanesoft\Contracts\Auth\Models\Permission|null |
|
261 | */ |
||
262 | private function getPermissionFromGroup($id) |
||
273 | |||
274 | 64 | /** |
|
275 | * Get a permission by id. |
||
276 | 64 | * |
|
277 | 24 | * @param int $id |
|
278 | 18 | * |
|
279 | * @return \Arcanesoft\Contracts\Auth\Models\Permission|null |
||
280 | 64 | */ |
|
281 | private function getPermissionById($id) |
||
288 | |||
289 | /** |
||
290 | * Load the permissions. |
||
291 | * |
||
292 | * @param bool $load |
||
293 | * |
||
294 | 16 | * @return self |
|
295 | */ |
||
296 | 16 | protected function loadPermissions($load = true) |
|
300 | |||
301 | /** |
||
302 | * Slugify the value. |
||
303 | * |
||
304 | * @param string $value |
||
305 | * |
||
306 | * @return string |
||
307 | */ |
||
308 | protected function slugify($value) |
||
312 | } |
||
313 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.