| Conditions | 5 |
| Paths | 1 |
| Total Lines | 13 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 2 |
| CRAP Score | 15.5468 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 38 | 99 | protected function defineGate() |
|
| 39 | { |
||
| 40 | 99 | Gate::before(function (HasRole $user, $ability, array $models) { |
|
| 41 | if ($user->isAdmin()) { |
||
| 42 | if (in_array($ability, ['delete', 'forceDelete'])) { |
||
| 43 | $model = head($models); |
||
| 44 | |||
| 45 | if ($model instanceof Model && $model->is($user)) { |
||
| 46 | return false; |
||
| 47 | } |
||
| 48 | } |
||
| 49 | |||
| 50 | return true; |
||
| 51 | } |
||
| 55 |