Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
AssignMoveUserToCompanyRequest
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 authorize
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 rules
0.00% covered (danger)
0.00%
0 / 17
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Http\Requests;
4
5use App\Http\Models\Auth\Role;
6use Illuminate\Foundation\Http\FormRequest;
7use Illuminate\Validation\Rule;
8
9class AssignMoveUserToCompanyRequest extends FormRequest
10{
11    /**
12     * Determine if the user is authorized to make this request.
13     */
14    public function authorize(): bool
15    {
16        return true;
17    }
18
19    /**
20     * Get the validation rules that apply to the request.
21     *
22     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
23     */
24    public function rules(): array
25    {
26        return [
27            'company_id' => 'required|string|max:255|exists:companies,_id',
28            'users' => "required|array|min:1",
29            'users.*.id' => 'required|string|max:255|exists:users,_id',
30            'users.*.plan' => 'required|string|max:255|exists:plans,stripe_id',
31            'users.*.group_id' => 'nullable|string|max:255|exists:company_groups,_id',
32            'users.*.subgroup_id' => 'nullable|string|max:255|exists:company_groups,_id',
33            'users.*.role' => ['required','string',
34                Rule::in([
35                    Role::USER,
36                    Role::REPORTING_ADMIN,
37                    Role::GROUP_ADMIN,
38                    Role::GLOBAL_ADMIN,
39                    Role::VENGRESO_ADMIN,
40                ])
41            ]
42        ];
43    }
44}