| Conditions | 6 |
| Paths | 4 |
| Total Lines | 18 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | public function __invoke(Company $form) |
||
| 11 | { |
||
| 12 | $role = \Auth::user()->role_id; |
||
|
|
|||
| 13 | $companies = \Auth::user()->person->companies()->count(); |
||
| 14 | |||
| 15 | if (in_array($role, [1, 2, 9, 10])) { |
||
| 16 | return ['form' => $form->create()]; |
||
| 17 | } |
||
| 18 | if (in_array($role, [4, 5, 6]) && $companies < 1) { |
||
| 19 | return ['form' => $form->create(), 'c' => $companies]; |
||
| 20 | } |
||
| 21 | // && $companies < 1 |
||
| 22 | |||
| 23 | if (in_array($role, [7, 8]) && $companies < 10) { |
||
| 24 | return ['form' => $form->create()]; |
||
| 25 | } |
||
| 26 | |||
| 27 | return ['error' => __('Unauthorized')]; |
||
| 28 | } |
||
| 30 |