Conditions | 3 |
Paths | 3 |
Total Lines | 14 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
27 | protected function prepareForValidation(): void |
||
28 | { |
||
29 | $data = $this->all(); |
||
30 | |||
31 | // Set abilities |
||
32 | if ($this->user($this->get('guard'))->can('grant', \Cortex\Auth\Models\Ability::class)) { |
||
33 | $data['abilities'] = $this->user($this->get('guard'))->can('superadmin') ? $this->get('abilities', []) |
||
34 | : $this->user($this->get('guard'))->abilities->pluck('id')->intersect($this->get('abilities', []))->toArray(); |
||
|
|||
35 | } else { |
||
36 | unset($data['abilities']); |
||
37 | } |
||
38 | |||
39 | $this->replace($data); |
||
40 | } |
||
41 | |||
57 |
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.