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 |
|
|
|
|
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
|
|
|
|