Passed
Push — feature/redux-job-get-update ( aa5c10...5de64c )
by Tristan
19:49 queued 13:46
created

UpdateJobPoster::rules()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 33
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 1.4083

Importance

Changes 0
Metric Value
eloc 31
dl 0
loc 33
ccs 8
cts 31
cp 0.2581
rs 9.424
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1.4083
1
<?php
2
3
namespace App\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
use Illuminate\Support\Facades\Config;
7
use App\Services\Validation\Rules\ValidIdRule;
8
use App\Models\Lookup\Department;
9
use App\Models\Lookup\Province;
10
use App\Models\Lookup\SecurityClearance;
11
use App\Models\Lookup\LanguageRequirement;
12
13
class UpdateJobPoster extends FormRequest
14
{
15
    /**
16
     * Determine if the user is authorized to make this request.
17
     *
18
     * @return boolean
19
     */
20 3
    public function authorize(): bool
21
    {
22 3
        return true;
23
    }
24
25
    /**
26
     * Get the validation rules that apply to the request.
27
     *
28
     * @return array
0 ignored issues
show
introduced by
@return annotation of method \App\Http\Requests\UpdateJobPoster::rules() does not specify type hint for items of its traversable return value.
Loading history...
29
     */
30 3
    public function rules(): array
31
    {
32 3
        $dateFormat = Config::get('app.api_datetime_format');
33 3
        $dateFormatRule = "date_format:$dateFormat";
34
        return [
35 3
            'term_qty' => 'nullable|numeric',
36 3
            'open_date_time' =>['nullable', $dateFormatRule],
37 3
            'close_date_time' => ['nullable', $dateFormatRule],
38 3
            'start_date_time' =>['nullable', $dateFormatRule],
39 3
            'department_id' => ['nullable', new DepartmentRule()],
40
            'province_id' => ['nullable', new ProvinceRule()],
41
            'security_clearance_id' => ['nullable', new SecurityClearanceRule()],
42
            'language_requirement_id' => ['nullable', new LanguageRequirementRule()],
43
            'salary_min' => 'nullable|numeric',
44
            'salary_max' => 'nullable|numeric',
45
            'noc' => 'nullable|numeric',
46
            'classification_code' => 'nullable|regex:/[A-Z]{2}/',
47
            'classification_level' => 'nullable|numeric',
48
            'remote_work_allowed' => 'nullable|boolean',
49
            'en.city' => 'nullable|string',
50
            'en.title' => 'nullable|string',
51
            'en.team_impact' => 'nullable|string',
52
            'en.hire_impact' => 'nullable|string',
53
            'en.division' => 'nullable|string',
54
            'en.branch' => 'nullable|string',
55
            'en.education' => 'nullable|string',
56
            'fr.city' => 'nullable|string',
57
            'fr.title' => 'nullable|string',
58
            'fr.team_impact' => 'nullable|string',
59
            'fr.hire_impact' => 'nullable|string',
60
            'fr.division' => 'nullable|string',
61
            'fr.branch' => 'nullable|string',
62
            'fr.education' => 'nullable|string',
63
        ];
64
    }
65
}
66