Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
16 | protected function prepareForValidation(): void |
||
17 | { |
||
18 | $data = $this->all(); |
||
19 | |||
20 | // Set abilities |
||
21 | if ($data['abilities'] && $this->user($this->route('guard'))->can('grant', \Cortex\Auth\Models\Ability::class)) { |
||
|
|||
22 | $abilities = array_map('intval', $this->get('abilities', [])); |
||
23 | $data['abilities'] = $this->user($this->route('guard'))->can('superadmin') ? $abilities |
||
24 | : $this->user($this->route('guard'))->getAbilities()->pluck('id')->intersect($abilities)->toArray(); |
||
25 | } else { |
||
26 | unset($data['abilities']); |
||
27 | } |
||
28 | |||
29 | $this->replace($data); |
||
30 | } |
||
31 | |||
47 |
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.