@@ 188-201 (lines=14) @@ | ||
185 | * @return bool |
|
186 | * @throws \Exception |
|
187 | */ |
|
188 | public function hasAnyPermission(...$permissions): bool |
|
189 | { |
|
190 | if (is_array($permissions[0])) { |
|
191 | $permissions = $permissions[0]; |
|
192 | } |
|
193 | ||
194 | foreach ($permissions as $permission) { |
|
195 | if ($this->checkPermissionTo($permission)) { |
|
196 | return true; |
|
197 | } |
|
198 | } |
|
199 | ||
200 | return false; |
|
201 | } |
|
202 | ||
203 | /** |
|
204 | * Determine if the model has all of the given permissions. |
|
@@ 211-224 (lines=14) @@ | ||
208 | * @return bool |
|
209 | * @throws \Exception |
|
210 | */ |
|
211 | public function hasAllPermissions(...$permissions): bool |
|
212 | { |
|
213 | if (is_array($permissions[0])) { |
|
214 | $permissions = $permissions[0]; |
|
215 | } |
|
216 | ||
217 | foreach ($permissions as $permission) { |
|
218 | if (! $this->hasPermissionTo($permission)) { |
|
219 | return false; |
|
220 | } |
|
221 | } |
|
222 | ||
223 | return true; |
|
224 | } |
|
225 | ||
226 | /** |
|
227 | * Determine if the model has, via roles, the given permission. |