Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 16
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
AssignRoleRequest
0.00% covered (danger)
0.00%
0 / 16
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 / 15
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\Validation\Rule;
7use Illuminate\Foundation\Http\FormRequest;
8
9class AssignRoleRequest 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            'role_name' => [
28                'required',
29                'string',
30                Rule::in([
31                    Role::USER,
32                    Role::REPORTING_ADMIN,
33                    Role::GROUP_ADMIN,
34                    Role::GLOBAL_ADMIN,
35                    Role::VENGRESO_ADMIN,
36                ])
37            ],
38            'groups' => 'sometimes|nullable|array',
39            'groups.*' => 'string|exists:company_groups,_id'
40        ];
41    }
42}