@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function authorize(): bool |
26 | 26 | { |
27 | - $job = $this->route('job'); |
|
27 | + $job = $this->route ('job'); |
|
28 | 28 | // Published jobs cannot be updated. |
29 | 29 | return $job && $job->published_at === null; |
30 | 30 | } |
@@ -36,23 +36,23 @@ discard block |
||
36 | 36 | */ |
37 | 37 | public function rules(): array |
38 | 38 | { |
39 | - $dateFormat = Config::get('app.api_datetime_format'); |
|
39 | + $dateFormat = Config::get ('app.api_datetime_format'); |
|
40 | 40 | $dateFormatRule = "date_format:$dateFormat"; |
41 | 41 | $sliderRule = 'between:1,4'; |
42 | 42 | return [ |
43 | - 'chosen_lang' => ['nullable', Rule::in(['en', 'fr'])], |
|
43 | + 'chosen_lang' => ['nullable', Rule::in (['en', 'fr'])], |
|
44 | 44 | 'term_qty' => 'nullable|numeric', |
45 | 45 | 'open_date_time' =>['nullable', $dateFormatRule], |
46 | 46 | 'close_date_time' => ['nullable', $dateFormatRule], |
47 | 47 | 'start_date_time' =>['nullable', $dateFormatRule], |
48 | - 'department_id' => ['nullable', new ValidIdRule(Department::class)], |
|
49 | - 'province_id' => ['nullable', new ValidIdRule(Province::class)], |
|
50 | - 'security_clearance_id' => ['nullable', new ValidIdRule(SecurityClearance::class)], |
|
51 | - 'language_requirement_id' => ['nullable', new ValidIdRule(LanguageRequirement::class)], |
|
48 | + 'department_id' => ['nullable', new ValidIdRule (Department::class)], |
|
49 | + 'province_id' => ['nullable', new ValidIdRule (Province::class)], |
|
50 | + 'security_clearance_id' => ['nullable', new ValidIdRule (SecurityClearance::class)], |
|
51 | + 'language_requirement_id' => ['nullable', new ValidIdRule (LanguageRequirement::class)], |
|
52 | 52 | 'salary_min' => 'nullable|numeric', |
53 | 53 | 'salary_max' => 'nullable|numeric', |
54 | 54 | 'noc' => 'nullable|numeric', |
55 | - 'classification_id' => ['nullable', new ValidIdRule(Classification::class)], |
|
55 | + 'classification_id' => ['nullable', new ValidIdRule (Classification::class)], |
|
56 | 56 | 'classification_level' => 'nullable|numeric', |
57 | 57 | 'remote_work_allowed' => 'nullable|boolean', |
58 | 58 | 'team_size' => 'nullable|numeric', |
@@ -63,10 +63,10 @@ discard block |
||
63 | 63 | 'experimental_vs_ongoing' => ['nullable', $sliderRule], |
64 | 64 | 'citizen_facing_vs_back_office' => ['nullable', $sliderRule], |
65 | 65 | 'collaborative_vs_independent' => ['nullable', $sliderRule], |
66 | - 'telework_allowed_frequency_id' => ['nullable', new ValidIdRule(Frequency::class)], |
|
67 | - 'flexible_hours_frequency_id' => ['nullable', new ValidIdRule(Frequency::class)], |
|
68 | - 'travel_requirement_id' => ['nullable', new ValidIdRule(TravelRequirement::class)], |
|
69 | - 'overtime_requirement_id' => ['nullable', new ValidIdRule(OvertimeRequirement::class)], |
|
66 | + 'telework_allowed_frequency_id' => ['nullable', new ValidIdRule (Frequency::class)], |
|
67 | + 'flexible_hours_frequency_id' => ['nullable', new ValidIdRule (Frequency::class)], |
|
68 | + 'travel_requirement_id' => ['nullable', new ValidIdRule (TravelRequirement::class)], |
|
69 | + 'overtime_requirement_id' => ['nullable', new ValidIdRule (OvertimeRequirement::class)], |
|
70 | 70 | 'en.city' => 'nullable|string', |
71 | 71 | 'en.title' => 'nullable|string', |
72 | 72 | 'en.dept_impact' => 'nullable|string', |
@@ -14,12 +14,12 @@ |
||
14 | 14 | */ |
15 | 15 | public function handle($request, Closure $next) |
16 | 16 | { |
17 | - $user = $request->user(); |
|
17 | + $user = $request->user (); |
|
18 | 18 | |
19 | - if ($user !== null && $user->isHrAdvisor() && !$user->isGovIdentityConfirmed()) { |
|
20 | - return redirect(route('hr_advisor.first_visit')); |
|
19 | + if ($user !== null && $user->isHrAdvisor () && !$user->isGovIdentityConfirmed ()) { |
|
20 | + return redirect (route ('hr_advisor.first_visit')); |
|
21 | 21 | } |
22 | 22 | |
23 | - return $next($request); |
|
23 | + return $next ($request); |
|
24 | 24 | } |
25 | 25 | } |
@@ -22,51 +22,51 @@ |
||
22 | 22 | */ |
23 | 23 | public function handle($request, Closure $next) |
24 | 24 | { |
25 | - if (Auth::check()) { |
|
26 | - $user = Auth::user(); |
|
25 | + if (Auth::check ()) { |
|
26 | + $user = Auth::user (); |
|
27 | 27 | |
28 | 28 | // If running in a local environment, and FORCE_ADMIN is true, |
29 | 29 | // automatically set any logged in user to (temporarilly) be an admin |
30 | - if (App::environment() == 'local' && Config::get('app.force_admin')) { |
|
31 | - $user->setRole('admin'); |
|
32 | - $user->save(); |
|
30 | + if (App::environment () == 'local' && Config::get ('app.force_admin')) { |
|
31 | + $user->setRole ('admin'); |
|
32 | + $user->save (); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | // Ensure the user has a proper profile associated with it |
36 | 36 | // If no profile exists yet create one. |
37 | 37 | // Admins should be given an applicant and manager profile |
38 | - if ($user->isApplicant() || |
|
39 | - $user->isAdmin() ) { |
|
38 | + if ($user->isApplicant () || |
|
39 | + $user->isAdmin ()) { |
|
40 | 40 | $applicantProfile = $user->applicant; |
41 | 41 | if ($applicantProfile === null) { |
42 | - $applicantProfile = new Applicant(); |
|
42 | + $applicantProfile = new Applicant (); |
|
43 | 43 | $applicantProfile->user_id = $user->id; |
44 | - $applicantProfile->save(); |
|
45 | - $user->refresh(); |
|
44 | + $applicantProfile->save (); |
|
45 | + $user->refresh (); |
|
46 | 46 | } |
47 | 47 | } |
48 | - if ($user->isManager() || |
|
49 | - $user->isAdmin()) { |
|
48 | + if ($user->isManager () || |
|
49 | + $user->isAdmin ()) { |
|
50 | 50 | $managerProfile = $user->manager; |
51 | 51 | if ($managerProfile === null) { |
52 | - $managerProfile = new Manager(); |
|
52 | + $managerProfile = new Manager (); |
|
53 | 53 | $managerProfile->user_id = $user->id; |
54 | - $managerProfile->save(); |
|
55 | - $user->refresh(); |
|
54 | + $managerProfile->save (); |
|
55 | + $user->refresh (); |
|
56 | 56 | } |
57 | 57 | } |
58 | - if ($user->isHrAdvisor() || |
|
59 | - $user->isAdmin()) { |
|
58 | + if ($user->isHrAdvisor () || |
|
59 | + $user->isAdmin ()) { |
|
60 | 60 | $hrAdvisorProfile = $user->hr_advisor; |
61 | 61 | if ($hrAdvisorProfile === null) { |
62 | - $hrAdvisorProfile = new HrAdvisor(); |
|
62 | + $hrAdvisorProfile = new HrAdvisor (); |
|
63 | 63 | $hrAdvisorProfile->user_id = $user->id; |
64 | - $hrAdvisorProfile->save(); |
|
65 | - $user->refresh(); |
|
64 | + $hrAdvisorProfile->save (); |
|
65 | + $user->refresh (); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | |
70 | - return $next($request); |
|
70 | + return $next ($request); |
|
71 | 71 | } |
72 | 72 | } |
@@ -21,23 +21,23 @@ |
||
21 | 21 | public function handle($request, Closure $next, $role) |
22 | 22 | { |
23 | 23 | // If user logged in as admin, always pass, regardless of $role. |
24 | - if (Auth::check() && Auth::user()->isAdmin()) { |
|
25 | - Log::info('CheckRole Bypassed as Admin'); |
|
26 | - return $next($request); |
|
24 | + if (Auth::check () && Auth::user ()->isAdmin ()) { |
|
25 | + Log::info ('CheckRole Bypassed as Admin'); |
|
26 | + return $next ($request); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Redirect if not logged in, or if not the correct role. |
30 | - if (Auth::guest() || !Auth::user()->hasRole($role)) { |
|
31 | - Log::info('CheckRole Failed'); |
|
30 | + if (Auth::guest () || !Auth::user ()->hasRole ($role)) { |
|
31 | + Log::info ('CheckRole Failed'); |
|
32 | 32 | // TODO: redirect to some sort of error messag |
33 | - if (WhichPortal::isManagerPortal()) { |
|
34 | - return redirect(route('manager.home')); |
|
35 | - } elseif (WhichPortal::isHrPortal()) { |
|
36 | - return redirect(route('hr_advisor.home')); |
|
33 | + if (WhichPortal::isManagerPortal ()) { |
|
34 | + return redirect (route ('manager.home')); |
|
35 | + } elseif (WhichPortal::isHrPortal ()) { |
|
36 | + return redirect (route ('hr_advisor.home')); |
|
37 | 37 | } else { |
38 | - return redirect(route('home')); |
|
38 | + return redirect (route ('home')); |
|
39 | 39 | } |
40 | 40 | } |
41 | - return $next($request); |
|
41 | + return $next ($request); |
|
42 | 42 | } |
43 | 43 | } |
@@ -18,18 +18,18 @@ |
||
18 | 18 | */ |
19 | 19 | public function handle($request, Closure $next, $guard = null) |
20 | 20 | { |
21 | - if (Auth::guard($guard)->check()) { |
|
22 | - if (Auth::user()->isAdmin()) { |
|
23 | - return redirect(backpack_url('')); |
|
24 | - } elseif (WhichPortal::isManagerPortal()) { |
|
25 | - return redirect(route('manager.home')); |
|
26 | - } elseif (WhichPortal::isHrPortal()) { |
|
27 | - return route('hr_advisor.home'); |
|
21 | + if (Auth::guard ($guard)->check ()) { |
|
22 | + if (Auth::user ()->isAdmin ()) { |
|
23 | + return redirect (backpack_url ('')); |
|
24 | + } elseif (WhichPortal::isManagerPortal ()) { |
|
25 | + return redirect (route ('manager.home')); |
|
26 | + } elseif (WhichPortal::isHrPortal ()) { |
|
27 | + return route ('hr_advisor.home'); |
|
28 | 28 | } else { |
29 | - return redirect(route('home')); |
|
29 | + return redirect (route ('home')); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | - return $next($request); |
|
33 | + return $next ($request); |
|
34 | 34 | } |
35 | 35 | } |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | { |
18 | 18 | // A lower default string length for migrations is required for |
19 | 19 | // versions of MySQL < 5.7.7 |
20 | - Schema::defaultStringLength(191); |
|
20 | + Schema::defaultStringLength (191); |
|
21 | 21 | |
22 | 22 | // Force all routes and requests to use HTTPS |
23 | - $this->app['request']->server->set('HTTPS', config('app.force_https')); |
|
23 | + $this->app['request']->server->set ('HTTPS', config ('app.force_https')); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function register() |
32 | 32 | { |
33 | - $this->app->singleton(WhichPortal::class, function ($app) { |
|
34 | - return new WhichPortal(); |
|
33 | + $this->app->singleton (WhichPortal::class, function ($app){ |
|
34 | + return new WhichPortal (); |
|
35 | 35 | }); |
36 | 36 | } |
37 | 37 | } |
@@ -9,48 +9,48 @@ |
||
9 | 9 | |
10 | 10 | public function isApplicantPortal() |
11 | 11 | { |
12 | - return !$this->isManagerPortal() && !$this->isHrPortal() && !$this->isAdminPortal(); |
|
12 | + return !$this->isManagerPortal () && !$this->isHrPortal () && !$this->isAdminPortal (); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function isManagerPortal() |
16 | 16 | { |
17 | - $url = URL::current(); |
|
18 | - return $this->urlIsManagerPortal($url); |
|
17 | + $url = URL::current (); |
|
18 | + return $this->urlIsManagerPortal ($url); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | public function isHrPortal() |
22 | 22 | { |
23 | - $url = URL::current(); |
|
24 | - return $this->urlIsHrPortal($url); |
|
23 | + $url = URL::current (); |
|
24 | + return $this->urlIsHrPortal ($url); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function isAdminPortal() |
28 | 28 | { |
29 | - $url = URL::current(); |
|
30 | - return $this->urlIsAdminPortal($url); |
|
29 | + $url = URL::current (); |
|
30 | + return $this->urlIsAdminPortal ($url); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | public function urlIsManagerPortal($url): bool |
34 | 34 | { |
35 | - $baseUrl = config('app.url'); |
|
36 | - $managerPrefix = config('app.manager_prefix'); |
|
35 | + $baseUrl = config ('app.url'); |
|
36 | + $managerPrefix = config ('app.manager_prefix'); |
|
37 | 37 | $managerPattern = "#^$baseUrl/(\w+/)?$managerPrefix(/.*)?$#"; |
38 | - return preg_match($managerPattern, $url); |
|
38 | + return preg_match ($managerPattern, $url); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function urlIsHrPortal($url): bool |
42 | 42 | { |
43 | - $baseUrl = config('app.url'); |
|
44 | - $hrPrefix = config('app.hr_prefix'); |
|
43 | + $baseUrl = config ('app.url'); |
|
44 | + $hrPrefix = config ('app.hr_prefix'); |
|
45 | 45 | $hrPattern = "#^$baseUrl/(\w+/)?$hrPrefix(/.*)?$#"; |
46 | - return preg_match($hrPattern, $url); |
|
46 | + return preg_match ($hrPattern, $url); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | public function urlIsAdminPortal($url): bool |
50 | 50 | { |
51 | - $baseUrl = config('app.url'); |
|
52 | - $adminPrefix = config('backpack.base.route_prefix', 'admin'); |
|
51 | + $baseUrl = config ('app.url'); |
|
52 | + $adminPrefix = config ('backpack.base.route_prefix', 'admin'); |
|
53 | 53 | $adminPattern = "#^$baseUrl/(\w+/)?$adminPrefix(/.*)?$#"; |
54 | - return preg_match($adminPattern, $url); |
|
54 | + return preg_match ($adminPattern, $url); |
|
55 | 55 | } |
56 | 56 | } |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function userValidator(array $data) |
40 | 40 | { |
41 | - return Validator::make($data, self::basicRules()); |
|
41 | + return Validator::make ($data, self::basicRules ()); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public static function managerValidator(array $data) |
51 | 51 | { |
52 | - $managerRules = array_merge(self::basicRules(), self::managerRegistrationExtraRules()); |
|
53 | - return Validator::make($data, $managerRules); |
|
52 | + $managerRules = array_merge (self::basicRules (), self::managerRegistrationExtraRules ()); |
|
53 | + return Validator::make ($data, $managerRules); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public static function finalizeManagerValidator(array $data) |
63 | 63 | { |
64 | - return Validator::make($data, self::managerRegistrationExtraRules()); |
|
64 | + return Validator::make ($data, self::managerRegistrationExtraRules ()); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -72,8 +72,8 @@ discard block |
||
72 | 72 | */ |
73 | 73 | public static function hrValidator(array $data) |
74 | 74 | { |
75 | - $hrRules = array_merge(self::basicRules(), self::managerRegistrationExtraRules()); |
|
76 | - return Validator::make($data, $hrRules); |
|
75 | + $hrRules = array_merge (self::basicRules (), self::managerRegistrationExtraRules ()); |
|
76 | + return Validator::make ($data, $hrRules); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -84,6 +84,6 @@ discard block |
||
84 | 84 | */ |
85 | 85 | public static function finalizeHrValidator(array $data) |
86 | 86 | { |
87 | - return Validator::make($data, self::managerRegistrationExtraRules()); |
|
87 | + return Validator::make ($data, self::managerRegistrationExtraRules ()); |
|
88 | 88 | } |
89 | 89 | } |
@@ -3,16 +3,16 @@ |
||
3 | 3 | use App\Models\JobPoster; |
4 | 4 | use App\Models\JobPosterQuestion; |
5 | 5 | |
6 | -$faker_fr = Faker\Factory::create('fr'); |
|
6 | +$faker_fr = Faker\Factory::create ('fr'); |
|
7 | 7 | |
8 | -$factory->define(JobPosterQuestion::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
8 | +$factory->define (JobPosterQuestion::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
9 | 9 | return [ |
10 | - 'job_poster_id' => function () { |
|
11 | - return factory(JobPoster::class)->create()->id; |
|
10 | + 'job_poster_id' => function (){ |
|
11 | + return factory (JobPoster::class)->create ()->id; |
|
12 | 12 | }, |
13 | - 'description:en' => $faker->sentence(), |
|
14 | - 'description:fr' => $faker_fr->sentence(), |
|
15 | - 'question:en' => $faker->paragraph(), |
|
16 | - 'question:fr' => $faker_fr->paragraph() |
|
13 | + 'description:en' => $faker->sentence (), |
|
14 | + 'description:fr' => $faker_fr->sentence (), |
|
15 | + 'question:en' => $faker->paragraph (), |
|
16 | + 'question:fr' => $faker_fr->paragraph () |
|
17 | 17 | ]; |
18 | 18 | }); |