| Conditions | 4 |
| Paths | 4 |
| Total Lines | 17 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 4 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | 23 | public function authorizedActions(): array |
|
| 10 | { |
||
| 11 | 23 | $authorizedActions = []; |
|
| 12 | |||
| 13 | 23 | $user = Auth::user(); |
|
| 14 | |||
| 15 | 23 | if (! $user) { |
|
| 16 | 1 | return $authorizedActions; |
|
| 17 | } |
||
| 18 | |||
| 19 | 22 | foreach ($this->actions as $action) { |
|
| 20 | 22 | if ($user->can($action, $this)) { |
|
| 21 | 22 | $authorizedActions[] = $action; |
|
| 22 | } |
||
| 23 | } |
||
| 24 | |||
| 25 | 22 | return $authorizedActions; |
|
| 26 | } |
||
| 28 |