| Conditions | 5 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 5 |
| Changes | 0 | ||
| 1 | <?php |
||
| 34 | 56 | protected function isAuthorized($item) |
|
| 35 | { |
||
| 36 | // Check if there are any permission defined for the item. |
||
| 37 | |||
| 38 | 56 | if (empty($item['can'])) { |
|
| 39 | 51 | return true; |
|
| 40 | } |
||
| 41 | |||
| 42 | // Read the extra arguments (a db model instance can be used). |
||
| 43 | |||
| 44 | 8 | $args = ! empty($item['model']) ? $item['model'] : []; |
|
| 45 | |||
| 46 | // Check if the current user can perform the configured permissions. |
||
| 47 | |||
| 48 | 8 | if (is_string($item['can']) || is_array($item['can'])) { |
|
| 49 | 7 | return Gate::any($item['can'], $args); |
|
| 50 | } |
||
| 51 | |||
| 52 | 1 | return true; |
|
| 53 | } |
||
| 55 |