@@ -5,16 +5,16 @@ |
||
5 | 5 | // -------------------------- |
6 | 6 | // This route file is loaded automatically by Backpack\Base. |
7 | 7 | // Routes you generate using Backpack\Generators will be placed here. |
8 | -Route::group([ |
|
9 | - 'prefix' => config('backpack.base.route_prefix', 'admin'), |
|
10 | - 'middleware' => ['web', config('backpack.base.middleware_key', 'admin')], |
|
8 | +Route::group ([ |
|
9 | + 'prefix' => config ('backpack.base.route_prefix', 'admin'), |
|
10 | + 'middleware' => ['web', config ('backpack.base.middleware_key', 'admin')], |
|
11 | 11 | 'namespace' => 'App\Http\Controllers\Admin', |
12 | 12 | ], function () : void { |
13 | 13 | // Custom admin routes. |
14 | - Route::crud('skill', 'SkillCrudController'); |
|
15 | - Route::crud('job-poster', 'JobPosterCrudController'); |
|
16 | - Route::crud('user', 'UserCrudController'); |
|
17 | - Route::crud('manager', 'ManagerCrudController'); |
|
18 | - Route::crud('department', 'DepartmentCrudController'); |
|
19 | - Route::crud('classification', 'ClassificationCrudController'); |
|
14 | + Route::crud ('skill', 'SkillCrudController'); |
|
15 | + Route::crud ('job-poster', 'JobPosterCrudController'); |
|
16 | + Route::crud ('user', 'UserCrudController'); |
|
17 | + Route::crud ('manager', 'ManagerCrudController'); |
|
18 | + Route::crud ('department', 'DepartmentCrudController'); |
|
19 | + Route::crud ('classification', 'ClassificationCrudController'); |
|
20 | 20 | }); |
@@ -18,14 +18,14 @@ discard block |
||
18 | 18 | * @param \App\JobApplication $jobApplication |
19 | 19 | * @return mixed |
20 | 20 | */ |
21 | - public function view(User $user, JobApplication $jobApplication) |
|
21 | + public function view (User $user, JobApplication $jobApplication) |
|
22 | 22 | { |
23 | - $authApplicant = ($user->isApplicant() && |
|
23 | + $authApplicant = ($user->isApplicant () && |
|
24 | 24 | $user->applicant->id === $jobApplication->applicant_id); |
25 | - $authManager = ($user->isManager() && |
|
26 | - $jobApplication->job_poster->manager->user->is($user)); |
|
25 | + $authManager = ($user->isManager () && |
|
26 | + $jobApplication->job_poster->manager->user->is ($user)); |
|
27 | 27 | |
28 | - return $authApplicant||$authManager; |
|
28 | + return $authApplicant || $authManager; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param \App\Models\User $user |
35 | 35 | * @return mixed |
36 | 36 | */ |
37 | - public function create(User $user) |
|
37 | + public function create (User $user) |
|
38 | 38 | { |
39 | 39 | return true; |
40 | 40 | } |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | * @param \App\JobApplication $jobApplication |
47 | 47 | * @return mixed |
48 | 48 | */ |
49 | - public function update(User $user, JobApplication $jobApplication) |
|
49 | + public function update (User $user, JobApplication $jobApplication) |
|
50 | 50 | { |
51 | - return $user->isApplicant() && |
|
51 | + return $user->isApplicant () && |
|
52 | 52 | $user->applicant->id === $jobApplication->applicant_id && |
53 | 53 | $jobApplication->application_status->name == 'draft' && |
54 | - $jobApplication->job_poster->isOpen(); |
|
54 | + $jobApplication->job_poster->isOpen (); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | * @param \App\JobApplication $jobApplication |
62 | 62 | * @return mixed |
63 | 63 | */ |
64 | - public function delete(User $user, JobApplication $jobApplication) |
|
64 | + public function delete (User $user, JobApplication $jobApplication) |
|
65 | 65 | { |
66 | - return $user->isApplicant() && |
|
66 | + return $user->isApplicant () && |
|
67 | 67 | $user->applicant->id === $jobApplication->applicant_id && |
68 | 68 | $jobApplication->application_status->name == 'draft'; |
69 | 69 | } |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param \App\JobApplication $jobApplication |
76 | 76 | * @return mixed |
77 | 77 | */ |
78 | - public function review(User $user, JobApplication $jobApplication) |
|
78 | + public function review (User $user, JobApplication $jobApplication) |
|
79 | 79 | { |
80 | 80 | // Only the manager in charge of the accompanying job can review an application, |
81 | 81 | // and only if it has been submitted |
82 | - return $user->isManager() && |
|
82 | + return $user->isManager () && |
|
83 | 83 | $jobApplication->job_poster->manager->user->id == $user->id && |
84 | 84 | $jobApplication->application_status->name != 'draft'; |
85 | 85 | } |
@@ -9,11 +9,11 @@ |
||
9 | 9 | { |
10 | 10 | use HandlesAuthorization; |
11 | 11 | |
12 | - public function before($user, $ability) |
|
12 | + public function before ($user, $ability) |
|
13 | 13 | { |
14 | - if ($user->isAdmin()) { |
|
14 | + if ($user->isAdmin ()) { |
|
15 | 15 | $userText = '{id='.$user->id.'}'; |
16 | - Log::notice('User '.$userText.' has bypassed policy as an Admin'); |
|
16 | + Log::notice ('User '.$userText.' has bypassed policy as an Admin'); |
|
17 | 17 | return true; |
18 | 18 | } |
19 | 19 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | * @param \App\Models\JobPoster $jobPoster |
18 | 18 | * @return mixed |
19 | 19 | */ |
20 | - public function view(?User $user, JobPoster $jobPoster) |
|
20 | + public function view (?User $user, JobPoster $jobPoster) |
|
21 | 21 | { |
22 | 22 | // Anyone can view a published job |
23 | 23 | // Only the manager that created it can view an unpublished job |
24 | - return $jobPoster->status() == 'published' || $jobPoster->status() == 'closed' || |
|
24 | + return $jobPoster->status () == 'published' || $jobPoster->status () == 'closed' || |
|
25 | 25 | ( |
26 | 26 | $user && |
27 | - $user->isManager() && |
|
27 | + $user->isManager () && |
|
28 | 28 | $jobPoster->manager->user_id == $user->id |
29 | 29 | ); |
30 | 30 | } |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | * @param \App\Models\User $user User to test against. |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function create(User $user) |
|
38 | + public function create (User $user) |
|
39 | 39 | { |
40 | 40 | // Any manager can create a new job poster. |
41 | - return $user->isManager(); |
|
41 | + return $user->isManager (); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -48,10 +48,10 @@ discard block |
||
48 | 48 | * @param \App\Models\JobPoster $jobPoster |
49 | 49 | * @return mixed |
50 | 50 | */ |
51 | - public function update(User $user, JobPoster $jobPoster) |
|
51 | + public function update (User $user, JobPoster $jobPoster) |
|
52 | 52 | { |
53 | 53 | // Only managers can edit jobs, and only their own, managers can't publish jobs or edit published jobs |
54 | - return $user->isManager() && |
|
54 | + return $user->isManager () && |
|
55 | 55 | $jobPoster->manager->user->id == $user->id && |
56 | 56 | !$jobPoster->published; |
57 | 57 | } |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | - public function delete(User $user, JobPoster $jobPoster) : bool |
|
67 | + public function delete (User $user, JobPoster $jobPoster) : bool |
|
68 | 68 | { |
69 | 69 | // Jobs can only be deleted when they're in the 'draft' |
70 | 70 | // state, and only by managers that created them. |
71 | - return $user->isManager() && |
|
71 | + return $user->isManager () && |
|
72 | 72 | $jobPoster->manager->user->id == $user->id && |
73 | 73 | !$jobPoster->published; |
74 | 74 | } |
@@ -80,13 +80,13 @@ discard block |
||
80 | 80 | * @param \App\Models\JobPoster $jobPoster |
81 | 81 | * @return mixed |
82 | 82 | */ |
83 | - public function submitForReview(User $user, JobPoster $jobPoster) |
|
83 | + public function submitForReview (User $user, JobPoster $jobPoster) |
|
84 | 84 | { |
85 | 85 | // Only upgradedManagers can submit jobs for review, only their own jobs, and only if they're still drafts. |
86 | 86 | // NOTE: this is one of the only permissions to require an upgradedManager, as opposed to a demoManager.var |
87 | - return $user->isUpgradedManager() && |
|
87 | + return $user->isUpgradedManager () && |
|
88 | 88 | $jobPoster->manager->user->id == $user->id && |
89 | - $jobPoster->status() === 'draft'; |
|
89 | + $jobPoster->status () === 'draft'; |
|
90 | 90 | } |
91 | 91 | /** |
92 | 92 | * Determine whether the user can review applications to the job poster. |
@@ -95,11 +95,11 @@ discard block |
||
95 | 95 | * @param \App\Models\JobPoster $jobPoster |
96 | 96 | * @return mixed |
97 | 97 | */ |
98 | - public function reviewApplicationsFor(User $user, JobPoster $jobPoster) |
|
98 | + public function reviewApplicationsFor (User $user, JobPoster $jobPoster) |
|
99 | 99 | { |
100 | 100 | // Only managers can review applications, and only for their own jobs. |
101 | - return $user->isManager() && |
|
101 | + return $user->isManager () && |
|
102 | 102 | $jobPoster->manager->user->id == $user->id && |
103 | - $jobPoster->isClosed(); |
|
103 | + $jobPoster->isClosed (); |
|
104 | 104 | } |
105 | 105 | } |
@@ -17,21 +17,21 @@ discard block |
||
17 | 17 | * @param \App\Models\Applicant $applicant Applicant object used within applications submitted to Job Poster. |
18 | 18 | * @return boolean |
19 | 19 | */ |
20 | - protected function ownsJobApplicantAppliedTo(User $user, Applicant $applicant) |
|
20 | + protected function ownsJobApplicantAppliedTo (User $user, Applicant $applicant) |
|
21 | 21 | { |
22 | 22 | $applicant_id = $applicant->id; |
23 | 23 | $user_id = $user->id; |
24 | - return JobPoster::whereHas( |
|
24 | + return JobPoster::whereHas ( |
|
25 | 25 | 'manager', |
26 | 26 | function ($q) use ($user_id) { |
27 | - $q->where('user_id', $user_id); |
|
27 | + $q->where ('user_id', $user_id); |
|
28 | 28 | } |
29 | - )->whereHas( |
|
29 | + )->whereHas ( |
|
30 | 30 | 'submitted_applications', |
31 | 31 | function ($q) use ($applicant_id) { |
32 | - $q->where('applicant_id', $applicant_id); |
|
32 | + $q->where ('applicant_id', $applicant_id); |
|
33 | 33 | } |
34 | - )->get()->isNotEmpty(); |
|
34 | + )->get ()->isNotEmpty (); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * @param \App\Models\Applicant $applicant Applicant object to be viewed. |
42 | 42 | * @return boolean |
43 | 43 | */ |
44 | - public function view(User $user, Applicant $applicant) |
|
44 | + public function view (User $user, Applicant $applicant) |
|
45 | 45 | { |
46 | - $authApplicant = $user->isApplicant() && |
|
47 | - $applicant->user->is($user); |
|
48 | - $authManager = $user->isManager() && $this->ownsJobApplicantAppliedTo($user, $applicant); |
|
46 | + $authApplicant = $user->isApplicant () && |
|
47 | + $applicant->user->is ($user); |
|
48 | + $authManager = $user->isManager () && $this->ownsJobApplicantAppliedTo ($user, $applicant); |
|
49 | 49 | return $authApplicant || $authManager; |
50 | 50 | } |
51 | 51 | |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @param \App\Models\User $user User object making the create request. |
56 | 56 | * @return boolean |
57 | 57 | */ |
58 | - public function create(User $user) |
|
58 | + public function create (User $user) |
|
59 | 59 | { |
60 | 60 | return false; |
61 | 61 | } |
@@ -67,9 +67,9 @@ discard block |
||
67 | 67 | * @param \App\Models\Applicant $applicant Applicant object being updated. |
68 | 68 | * @return boolean |
69 | 69 | */ |
70 | - public function update(User $user, Applicant $applicant) |
|
70 | + public function update (User $user, Applicant $applicant) |
|
71 | 71 | { |
72 | - return $user->isApplicant() && |
|
72 | + return $user->isApplicant () && |
|
73 | 73 | $applicant->user_id === $user->id; |
74 | 74 | } |
75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | * @param \App\Models\Applicant $applicant Applicant object being deleted. |
81 | 81 | * @return void |
82 | 82 | */ |
83 | - public function delete(User $user, Applicant $applicant) |
|
83 | + public function delete (User $user, Applicant $applicant) |
|
84 | 84 | { |
85 | 85 | } |
86 | 86 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param \App\Models\Applicant $applicant Applicant object being restored. |
92 | 92 | * @return void |
93 | 93 | */ |
94 | - public function restore(User $user, Applicant $applicant) |
|
94 | + public function restore (User $user, Applicant $applicant) |
|
95 | 95 | { |
96 | 96 | } |
97 | 97 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * @param \App\Models\Applicant $applicant Applicant object being forceDeleted. |
103 | 103 | * @return void |
104 | 104 | */ |
105 | - public function forceDelete(User $user, Applicant $applicant) |
|
105 | + public function forceDelete (User $user, Applicant $applicant) |
|
106 | 106 | { |
107 | 107 | } |
108 | 108 | } |
@@ -5,7 +5,7 @@ discard block |
||
5 | 5 | use Illuminate\Support\Facades\Config; |
6 | 6 | use Illuminate\Support\Facades\Lang; |
7 | 7 | |
8 | -if (!function_exists('humanizeDate')) { |
|
8 | +if (!function_exists ('humanizeDate')) { |
|
9 | 9 | /** |
10 | 10 | * Computes a human readable localized date. |
11 | 11 | * |
@@ -13,19 +13,19 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @return string |
15 | 15 | */ |
16 | - function humanizeDate(Date $datetime) : string |
|
16 | + function humanizeDate (Date $datetime) : string |
|
17 | 17 | { |
18 | - $dateFormat = Config::get('app.date_format'); |
|
19 | - $locale = App::getLocale(); |
|
20 | - $timezone = Config::get('app.local_timezone'); |
|
18 | + $dateFormat = Config::get ('app.date_format'); |
|
19 | + $locale = App::getLocale (); |
|
20 | + $timezone = Config::get ('app.local_timezone'); |
|
21 | 21 | |
22 | - $datetime->setTimezone(new \DateTimeZone($timezone)); |
|
22 | + $datetime->setTimezone (new \DateTimeZone ($timezone)); |
|
23 | 23 | |
24 | - return $datetime->format($dateFormat[$locale]); |
|
24 | + return $datetime->format ($dateFormat[$locale]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | |
28 | -if (!function_exists('humanizeTime')) { |
|
28 | +if (!function_exists ('humanizeTime')) { |
|
29 | 29 | /** |
30 | 30 | * Computes a human readable localized time. |
31 | 31 | * |
@@ -33,25 +33,25 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return string |
35 | 35 | */ |
36 | - function humanizeTime(Date $datetime) : string |
|
36 | + function humanizeTime (Date $datetime) : string |
|
37 | 37 | { |
38 | - $timeFormat = Config::get('app.time_format'); |
|
39 | - $locale = App::getLocale(); |
|
40 | - $timezone = Config::get('app.local_timezone'); |
|
38 | + $timeFormat = Config::get ('app.time_format'); |
|
39 | + $locale = App::getLocale (); |
|
40 | + $timezone = Config::get ('app.local_timezone'); |
|
41 | 41 | |
42 | - $datetime->setTimezone(new \DateTimeZone($timezone)); |
|
42 | + $datetime->setTimezone (new \DateTimeZone ($timezone)); |
|
43 | 43 | |
44 | - $displayTime = $datetime->format($timeFormat[$locale]); |
|
44 | + $displayTime = $datetime->format ($timeFormat[$locale]); |
|
45 | 45 | |
46 | 46 | if ($locale == 'fr') { |
47 | - $displayTime = str_replace(['EST', 'EDT'], ['HNE', 'HAE'], $displayTime); |
|
47 | + $displayTime = str_replace (['EST', 'EDT'], ['HNE', 'HAE'], $displayTime); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $displayTime; |
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | -if (!function_exists('humanizeDateDiff')) { |
|
54 | +if (!function_exists ('humanizeDateDiff')) { |
|
55 | 55 | /** |
56 | 56 | * Computes a human readable time difference between two dates. |
57 | 57 | * |
@@ -60,12 +60,12 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - function humanizeDateDiff(Date $datetime, Date $origin = null) : string |
|
63 | + function humanizeDateDiff (Date $datetime, Date $origin = null) : string |
|
64 | 64 | { |
65 | 65 | if (!isset($origin)) { |
66 | - $origin = new Date(); |
|
66 | + $origin = new Date (); |
|
67 | 67 | } |
68 | - $interval = $datetime->diff($origin); |
|
68 | + $interval = $datetime->diff ($origin); |
|
69 | 69 | |
70 | 70 | $d = $interval->d; |
71 | 71 | $h = $interval->h; |
@@ -88,11 +88,11 @@ discard block |
||
88 | 88 | |
89 | 89 | $key = "common/time.$unit"; |
90 | 90 | |
91 | - return Lang::choice($key, $count); |
|
91 | + return Lang::choice ($key, $count); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | -if (!function_exists('humanizeLastDay')) { |
|
95 | +if (!function_exists ('humanizeLastDay')) { |
|
96 | 96 | /** |
97 | 97 | * Returns the date of the last full day a person has before a deadline time. |
98 | 98 | * |
@@ -100,15 +100,15 @@ discard block |
||
100 | 100 | * |
101 | 101 | * @return string |
102 | 102 | */ |
103 | - function humanizeLastDay(Date $datetime) : string |
|
103 | + function humanizeLastDay (Date $datetime) : string |
|
104 | 104 | { |
105 | - $lastday = $datetime->sub('1 day'); |
|
105 | + $lastday = $datetime->sub ('1 day'); |
|
106 | 106 | |
107 | - return humanizeDate($lastday); |
|
107 | + return humanizeDate ($lastday); |
|
108 | 108 | } |
109 | 109 | } |
110 | 110 | |
111 | -if (!function_exists('ptDayStartToUtcTime')) { |
|
111 | +if (!function_exists ('ptDayStartToUtcTime')) { |
|
112 | 112 | /** |
113 | 113 | * Given a date, creates a datetime object representing the start of day |
114 | 114 | * in the most Western timezone in Canada (America/Vancouver). |
@@ -117,21 +117,21 @@ discard block |
||
117 | 117 | * |
118 | 118 | * @return Date |
119 | 119 | */ |
120 | - function ptDayStartToUtcTime(string $date) : Date |
|
120 | + function ptDayStartToUtcTime (string $date) : Date |
|
121 | 121 | { |
122 | - $jobTimezone = Config::get('app.job_timezone'); |
|
123 | - $dbTimezone = Config::get('app.timezone'); |
|
122 | + $jobTimezone = Config::get ('app.job_timezone'); |
|
123 | + $dbTimezone = Config::get ('app.timezone'); |
|
124 | 124 | // Create a new date that's the beginning of the day in |
125 | 125 | // Pacific Daylight/Standard Time. |
126 | - $date = new Date("$date 00:00:00", new \DateTimeZone($jobTimezone)); |
|
126 | + $date = new Date ("$date 00:00:00", new \DateTimeZone ($jobTimezone)); |
|
127 | 127 | // Convert to UTC for correct offset. |
128 | - $date->setTimezone($dbTimezone); |
|
128 | + $date->setTimezone ($dbTimezone); |
|
129 | 129 | |
130 | 130 | return $date; |
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -if (!function_exists('ptDayEndToUtcTime')) { |
|
134 | +if (!function_exists ('ptDayEndToUtcTime')) { |
|
135 | 135 | /** |
136 | 136 | * Given a date, creates a datetime object representing the start of day |
137 | 137 | * in the most Western timezone in Canada (America/Vancouver). |
@@ -140,15 +140,15 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return Date |
142 | 142 | */ |
143 | - function ptDayEndToUtcTime(string $date) : Date |
|
143 | + function ptDayEndToUtcTime (string $date) : Date |
|
144 | 144 | { |
145 | - $jobTimezone = Config::get('app.job_timezone'); |
|
146 | - $dbTimezone = Config::get('app.timezone'); |
|
145 | + $jobTimezone = Config::get ('app.job_timezone'); |
|
146 | + $dbTimezone = Config::get ('app.timezone'); |
|
147 | 147 | // Create a new date that's the beginning of the day in |
148 | 148 | // Pacific Daylight/Standard Time. |
149 | - $date = new Date("$date 23:59:59", new \DateTimeZone($jobTimezone)); |
|
149 | + $date = new Date ("$date 23:59:59", new \DateTimeZone ($jobTimezone)); |
|
150 | 150 | // Convert to UTC for correct offset. |
151 | - $date->setTimezone($dbTimezone); |
|
151 | + $date->setTimezone ($dbTimezone); |
|
152 | 152 | |
153 | 153 | return $date; |
154 | 154 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @return void |
18 | 18 | */ |
19 | - public function __construct(User $user) |
|
19 | + public function __construct (User $user) |
|
20 | 20 | { |
21 | 21 | $this->user = $user; |
22 | 22 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @return void |
18 | 18 | */ |
19 | - public function __construct(JobPoster $job) |
|
19 | + public function __construct (JobPoster $job) |
|
20 | 20 | { |
21 | 21 | $this->job = $job; |
22 | 22 | } |
@@ -16,7 +16,7 @@ |
||
16 | 16 | * |
17 | 17 | * @return void |
18 | 18 | */ |
19 | - public function __construct(JobApplication $application) |
|
19 | + public function __construct (JobApplication $application) |
|
20 | 20 | { |
21 | 21 | $this->application = $application; |
22 | 22 | } |