Passed
Push — feature/job-builder/step-0 ( d77267 )
by Yonathan
10:26
created

UpdateJobPoster::authorize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

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