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 string[] |
29
|
|
|
*/ |
30
|
4 |
|
public function rules(): array |
31
|
|
|
{ |
32
|
4 |
|
$dateFormat = Config::get('app.api_datetime_format'); |
33
|
4 |
|
$dateFormatRule = "date_format:$dateFormat"; |
34
|
|
|
return [ |
|
|
|
|
35
|
4 |
|
'term_qty' => 'nullable|numeric', |
36
|
4 |
|
'open_date_time' =>['nullable', $dateFormatRule], |
37
|
4 |
|
'close_date_time' => ['nullable', $dateFormatRule], |
38
|
4 |
|
'start_date_time' =>['nullable', $dateFormatRule], |
39
|
4 |
|
'department_id' => ['nullable', new ValidIdRule(Department::class)], |
40
|
4 |
|
'province_id' => ['nullable', new ValidIdRule(Province::class)], |
41
|
4 |
|
'security_clearance_id' => ['nullable', new ValidIdRule(SecurityClearance::class)], |
42
|
4 |
|
'language_requirement_id' => ['nullable', new ValidIdRule(LanguageRequirement::class)], |
43
|
4 |
|
'salary_min' => 'nullable|numeric', |
44
|
4 |
|
'salary_max' => 'nullable|numeric', |
45
|
4 |
|
'noc' => 'nullable|numeric', |
46
|
4 |
|
'classification_code' => 'nullable|regex:/[A-Z]{2}/', |
47
|
4 |
|
'classification_level' => 'nullable|numeric', |
48
|
4 |
|
'remote_work_allowed' => 'nullable|boolean', |
49
|
4 |
|
'en.city' => 'nullable|string', |
50
|
4 |
|
'en.title' => 'nullable|string', |
51
|
4 |
|
'en.team_impact' => 'nullable|string', |
52
|
4 |
|
'en.hire_impact' => 'nullable|string', |
53
|
4 |
|
'en.division' => 'nullable|string', |
54
|
4 |
|
'en.branch' => 'nullable|string', |
55
|
4 |
|
'en.education' => 'nullable|string', |
56
|
4 |
|
'fr.city' => 'nullable|string', |
57
|
4 |
|
'fr.title' => 'nullable|string', |
58
|
4 |
|
'fr.team_impact' => 'nullable|string', |
59
|
4 |
|
'fr.hire_impact' => 'nullable|string', |
60
|
4 |
|
'fr.division' => 'nullable|string', |
61
|
4 |
|
'fr.branch' => 'nullable|string', |
62
|
4 |
|
'fr.education' => 'nullable|string', |
63
|
|
|
]; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|