Passed
Push — task/applicant-profile-api ( bae4f4 )
by Yonathan
05:49
created

UpdateApplicantProfile   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 8
c 1
b 0
f 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A rules() 0 8 1
A authorize() 0 4 1
1
<?php
2
3
namespace App\Http\Requests;
4
5
use App\Models\Classification;
6
use App\Models\Lookup\CitizenshipDeclaration;
7
use App\Models\Lookup\VeteranStatus;
8
use App\Services\Validation\Rules\ValidIdRule;
9
use Illuminate\Foundation\Http\FormRequest;
10
11
class UpdateApplicantProfile extends FormRequest
12
{
13
    /**
14
     * Determine if the user is authorized to make this request.
15
     *
16
     * @return bool
17
     */
18
    public function authorize()
19
    {
20
        // Authorization is handled in Applicant Policy through middleware.
21
        return true;
22
    }
23
24
    /**
25
     * Get the validation rules that apply to the request.
26
     *
27
     * @return array
28
     */
29
    public function rules()
30
    {
31
        return [
32
            'citizenship_declaration_id' => ['required', new ValidIdRule(CitizenshipDeclaration::class)],
33
            'veteran_status_id' => ['required', new ValidIdRule(VeteranStatus::class)],
34
            'classifications.*.id' => ['required', new ValidIdRule(Classification::class)],
35
            'classifications.*.level' => 'required|integer|min:0|max:9',
36
            'classifications.*.order' => 'required|integer|min:0|max:9',
37
        ];
38
    }
39
}
40