|
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
|
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 ValidIdRule(Department::class)], |
|
40
|
3 |
|
'province_id' => ['nullable', new ValidIdRule(Province::class)], |
|
41
|
3 |
|
'security_clearance_id' => ['nullable', new ValidIdRule(SecurityClearance::class)], |
|
42
|
3 |
|
'language_requirement_id' => ['nullable', new ValidIdRule(LanguageRequirement::class)], |
|
43
|
3 |
|
'salary_min' => 'nullable|numeric', |
|
44
|
3 |
|
'salary_max' => 'nullable|numeric', |
|
45
|
3 |
|
'noc' => 'nullable|numeric', |
|
46
|
3 |
|
'classification_code' => 'nullable|regex:/[A-Z]{2}/', |
|
47
|
3 |
|
'classification_level' => 'nullable|numeric', |
|
48
|
3 |
|
'remote_work_allowed' => 'nullable|boolean', |
|
49
|
3 |
|
'en.city' => 'nullable|string', |
|
50
|
3 |
|
'en.title' => 'nullable|string', |
|
51
|
3 |
|
'en.team_impact' => 'nullable|string', |
|
52
|
3 |
|
'en.hire_impact' => 'nullable|string', |
|
53
|
3 |
|
'en.division' => 'nullable|string', |
|
54
|
3 |
|
'en.branch' => 'nullable|string', |
|
55
|
3 |
|
'en.education' => 'nullable|string', |
|
56
|
3 |
|
'fr.city' => 'nullable|string', |
|
57
|
3 |
|
'fr.title' => 'nullable|string', |
|
58
|
3 |
|
'fr.team_impact' => 'nullable|string', |
|
59
|
3 |
|
'fr.hire_impact' => 'nullable|string', |
|
60
|
3 |
|
'fr.division' => 'nullable|string', |
|
61
|
3 |
|
'fr.branch' => 'nullable|string', |
|
62
|
3 |
|
'fr.education' => 'nullable|string', |
|
63
|
|
|
]; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|