@@ 196-209 (lines=14) @@ | ||
193 | * @return bool |
|
194 | * @throws \Exception |
|
195 | */ |
|
196 | public function hasAnyPermission(...$permissions): bool |
|
197 | { |
|
198 | if (is_array($permissions[0])) { |
|
199 | $permissions = $permissions[0]; |
|
200 | } |
|
201 | ||
202 | foreach ($permissions as $permission) { |
|
203 | if ($this->checkPermissionTo($permission)) { |
|
204 | return true; |
|
205 | } |
|
206 | } |
|
207 | ||
208 | return false; |
|
209 | } |
|
210 | ||
211 | /** |
|
212 | * Determine if the model has all of the given permissions. |
|
@@ 219-232 (lines=14) @@ | ||
216 | * @return bool |
|
217 | * @throws \Exception |
|
218 | */ |
|
219 | public function hasAllPermissions(...$permissions): bool |
|
220 | { |
|
221 | if (is_array($permissions[0])) { |
|
222 | $permissions = $permissions[0]; |
|
223 | } |
|
224 | ||
225 | foreach ($permissions as $permission) { |
|
226 | if (!$this->hasPermissionTo($permission)) { |
|
227 | return false; |
|
228 | } |
|
229 | } |
|
230 | ||
231 | return true; |
|
232 | } |
|
233 | ||
234 | /** |
|
235 | * Determine if the model has, via roles, the given permission. |