Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
UpdateRolePlaySkillProgressionsRequest
100.00% covered (success)
100.00%
12 / 12
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 authorize
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
1 / 1
1
 rules
100.00% covered (success)
100.00%
9 / 9
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Requests\v2\RolePlay;
4
5use App\Http\Models\Auth\Role;
6use Illuminate\Foundation\Http\FormRequest;
7
8class UpdateRolePlaySkillProgressionsRequest extends FormRequest
9{
10    /**
11     * Determine if the user is authorized to make this request.
12     */
13    public function authorize(): bool
14    {
15        $user = $this->user();
16
17        $roles = $user->roles();
18
19        return in_array(Role::VENGRESO_ADMIN, $roles);
20    }
21
22    /**
23     * Get the validation rules that apply to the request.
24     *
25     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
26     */
27    public function rules(): array
28    {
29        return [
30            'type' => 'required|in:cold-call,discovery-call',
31            'status' => 'required|string',
32            'scorecard_config' => 'required|array|min:1',
33            'scorecard_config.*.name' => 'required|string',
34            'scorecard_config.*.criteria' => 'required|array|min:1',
35            'scorecard_config.*.criteria.*.name' => 'required|string',
36            'scorecard_config.*.criteria.*.description' => 'required|string',
37        ];
38    }
39}