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