Passed
Push — feature/hr-portal ( ae4ab3...ab04c7 )
by Chris
12:13 queued 11s
created
app/Http/Controllers/Auth/ResetPasswordController.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -31,12 +31,12 @@  discard block
 block discarded – undo
31 31
      */
32 32
     protected function redirectTo()
33 33
     {
34
-        if (WhichPortal::isManagerPortal()) {
35
-            $redirectTo = route('manager.home');
36
-        } elseif (WhichPortal::isHrPortal()) {
37
-            $redirectTo = route('hr_advisor.home');
34
+        if (WhichPortal::isManagerPortal ()) {
35
+            $redirectTo = route ('manager.home');
36
+        } elseif (WhichPortal::isHrPortal ()) {
37
+            $redirectTo = route ('hr_advisor.home');
38 38
         } else {
39
-            $redirectTo = route('home');
39
+            $redirectTo = route ('home');
40 40
         }
41 41
         return $redirectTo;
42 42
     }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public function __construct()
50 50
     {
51
-        $this->middleware('guest');
51
+        $this->middleware ('guest');
52 52
     }
53 53
 
54 54
     /**
@@ -62,11 +62,11 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function showResetForm(Request $request, $token = null)
64 64
     {
65
-        return view('auth.passwords.reset')->with([
65
+        return view ('auth.passwords.reset')->with ([
66 66
             'token' => $token,
67 67
             'email' => $request->email,
68
-            'routes' => $this->auth_routes(),
69
-            'reset_password' => Lang::get('common/auth/reset_password'),
68
+            'routes' => $this->auth_routes (),
69
+            'reset_password' => Lang::get ('common/auth/reset_password'),
70 70
         ]);
71 71
     }
72 72
 
Please login to merge, or discard this patch.
app/Http/Controllers/JobController.php 1 patch
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
23 23
      */
24 24
     public function index()
25 25
     {
26
-        $now = Carbon::now();
26
+        $now = Carbon::now ();
27 27
 
28 28
         // Find published jobs that are currently open for applications.
29 29
         // Eager load required relationships: Department, Province, JobTerm.
30 30
         // Eager load the count of submitted applications, to prevent the relationship
31 31
         // from being actually loaded and firing off events.
32
-        $jobs = JobPoster::where('open_date_time', '<=', $now)
33
-            ->where('close_date_time', '>=', $now)
34
-            ->where('published', true)
35
-            ->with([
32
+        $jobs = JobPoster::where ('open_date_time', '<=', $now)
33
+            ->where ('close_date_time', '>=', $now)
34
+            ->where ('published', true)
35
+            ->with ([
36 36
                 'department',
37 37
                 'province',
38 38
                 'job_term',
39 39
             ])
40
-            ->withCount([
40
+            ->withCount ([
41 41
                 'submitted_applications',
42 42
             ])
43
-            ->get();
44
-        return view('applicant/job_index', [
45
-            'job_index' => Lang::get('applicant/job_index'),
43
+            ->get ();
44
+        return view ('applicant/job_index', [
45
+            'job_index' => Lang::get ('applicant/job_index'),
46 46
             'jobs' => $jobs
47 47
         ]);
48 48
     }
@@ -54,31 +54,31 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function managerIndex()
56 56
     {
57
-        $manager = Auth::user()->manager;
57
+        $manager = Auth::user ()->manager;
58 58
 
59
-        $jobs = JobPoster::where('manager_id', $manager->id)
60
-            ->with('classification')
61
-            ->withCount('submitted_applications')
62
-            ->get();
59
+        $jobs = JobPoster::where ('manager_id', $manager->id)
60
+            ->with ('classification')
61
+            ->withCount ('submitted_applications')
62
+            ->get ();
63 63
 
64 64
         foreach ($jobs as &$job) {
65 65
             $chosen_lang = $job->chosen_lang;
66 66
 
67 67
             // Show chosen lang title if current title is empty.
68 68
             if (empty($job->title)) {
69
-                $job->title = $job->translate($chosen_lang)->title;
69
+                $job->title = $job->translate ($chosen_lang)->title;
70 70
                 $job->trans_required = true;
71 71
             }
72 72
 
73 73
             // Always preview and edit in the chosen language.
74
-            $job->preview_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.show', $job));
75
-            $job->edit_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.edit', $job));
74
+            $job->preview_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.show', $job));
75
+            $job->edit_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.edit', $job));
76 76
         }
77 77
 
78 78
 
79
-        return view('manager/job_index', [
79
+        return view ('manager/job_index', [
80 80
             // Localization Strings.
81
-            'jobs_l10n' => Lang::get('manager/job_index'),
81
+            'jobs_l10n' => Lang::get ('manager/job_index'),
82 82
             // Data.
83 83
             'jobs' => $jobs,
84 84
         ]);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function destroy(Request $request, JobPoster $jobPoster)
95 95
     {
96
-        $jobPoster->delete();
96
+        $jobPoster->delete ();
97 97
     }
98 98
 
99 99
     /**
@@ -105,14 +105,14 @@  discard block
 block discarded – undo
105 105
      */
106 106
     public function show(Request $request, JobPoster $jobPoster)
107 107
     {
108
-        $jobPoster->load([
108
+        $jobPoster->load ([
109 109
             'department',
110 110
             'criteria.skill.skill_type',
111 111
             'manager.team_culture',
112 112
             'manager.work_environment'
113 113
         ]);
114 114
 
115
-        $user = Auth::user();
115
+        $user = Auth::user ();
116 116
 
117 117
         // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model.
118 118
         $workplacePhotos = [];
@@ -125,36 +125,36 @@  discard block
 block discarded – undo
125 125
 
126 126
         // TODO: replace route('manager.show',manager.id) in templates with link using slug.
127 127
         $criteria = [
128
-            'essential' => $jobPoster->criteria->filter(
129
-                function ($value, $key) {
128
+            'essential' => $jobPoster->criteria->filter (
129
+                function ($value, $key){
130 130
                     return $value->criteria_type->name == 'essential';
131 131
                 }
132 132
             ),
133
-            'asset' => $jobPoster->criteria->filter(
134
-                function ($value, $key) {
133
+            'asset' => $jobPoster->criteria->filter (
134
+                function ($value, $key){
135 135
                     return $value->criteria_type->name == 'asset';
136 136
                 }
137 137
             ),
138 138
         ];
139 139
 
140
-        $jobLang = Lang::get('applicant/job_post');
140
+        $jobLang = Lang::get ('applicant/job_post');
141 141
 
142 142
         $applyButton = [];
143
-        if (!$jobPoster->published && $this->authorize('update', $jobPoster)) {
143
+        if (!$jobPoster->published && $this->authorize ('update', $jobPoster)) {
144 144
             $applyButton = [
145
-                'href' => route('manager.jobs.edit', $jobPoster->id),
145
+                'href' => route ('manager.jobs.edit', $jobPoster->id),
146 146
                 'title' => $jobLang['apply']['edit_link_title'],
147 147
                 'text' => $jobLang['apply']['edit_link_label'],
148 148
             ];
149
-        } elseif (Auth::check() && $jobPoster->isOpen()) {
149
+        } elseif (Auth::check () && $jobPoster->isOpen ()) {
150 150
             $applyButton = [
151
-                'href' => route('job.application.edit.1', $jobPoster->id),
151
+                'href' => route ('job.application.edit.1', $jobPoster->id),
152 152
                 'title' => $jobLang['apply']['apply_link_title'],
153 153
                 'text' => $jobLang['apply']['apply_link_label'],
154 154
             ];
155
-        } elseif (Auth::guest() && $jobPoster->isOpen()) {
155
+        } elseif (Auth::guest () && $jobPoster->isOpen ()) {
156 156
             $applyButton = [
157
-                'href' => route('job.application.edit.1', $jobPoster->id),
157
+                'href' => route ('job.application.edit.1', $jobPoster->id),
158 158
                 'title' => $jobLang['apply']['login_link_title'],
159 159
                 'text' => $jobLang['apply']['login_link_label'],
160 160
             ];
@@ -166,19 +166,19 @@  discard block
 block discarded – undo
166 166
             ];
167 167
         }
168 168
 
169
-        $jpb_release_date = strtotime('2019-08-21 16:18:17');
170
-        $job_created_at = strtotime($jobPoster->created_at);
169
+        $jpb_release_date = strtotime ('2019-08-21 16:18:17');
170
+        $job_created_at = strtotime ($jobPoster->created_at);
171 171
 
172 172
         // If the job poster is created after the release of the JPB.
173 173
         // Then, render with updated poster template.
174 174
         // Else, render with old poster template.
175 175
         if ($job_created_at > $jpb_release_date) {
176 176
             // Updated job poster (JPB).
177
-            return view(
177
+            return view (
178 178
                 'applicant/jpb_job_post',
179 179
                 [
180 180
                     'job_post' => $jobLang,
181
-                    'skill_template' => Lang::get('common/skills'),
181
+                    'skill_template' => Lang::get ('common/skills'),
182 182
                     'job' => $jobPoster,
183 183
                     'manager' => $jobPoster->manager,
184 184
                     'criteria' => $criteria,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
             );
188 188
         } else {
189 189
             // Old job poster.
190
-            return view(
190
+            return view (
191 191
                 'applicant/job_post',
192 192
                 [
193 193
                     'job_post' => $jobLang,
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     'job' => $jobPoster,
200 200
                     'criteria' => $criteria,
201 201
                     'apply_button' => $applyButton,
202
-                    'skill_template' => Lang::get('common/skills'),
202
+                    'skill_template' => Lang::get ('common/skills'),
203 203
                 ]
204 204
             );
205 205
         }
@@ -217,20 +217,20 @@  discard block
 block discarded – undo
217 217
     {
218 218
         $manager = $jobPoster->manager;
219 219
 
220
-        if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count() === 0) {
221
-            $jobPoster->job_poster_questions()->saveMany($this->populateDefaultQuestions());
222
-            $jobPoster->refresh();
220
+        if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count () === 0) {
221
+            $jobPoster->job_poster_questions ()->saveMany ($this->populateDefaultQuestions ());
222
+            $jobPoster->refresh ();
223 223
         }
224 224
 
225
-        return view(
225
+        return view (
226 226
             'manager/job_create',
227 227
             [
228 228
                 // Localization Strings.
229
-                'job_l10n' => Lang::get('manager/job_edit'),
229
+                'job_l10n' => Lang::get ('manager/job_edit'),
230 230
                 // Data.
231 231
                 'manager' => $manager,
232 232
                 'job' => $jobPoster,
233
-                'form_action_url' => route('admin.jobs.update', $jobPoster),
233
+                'form_action_url' => route ('admin.jobs.update', $jobPoster),
234 234
             ]
235 235
         );
236 236
     }
@@ -243,21 +243,21 @@  discard block
 block discarded – undo
243 243
      */
244 244
     public function createAsManager(Manager $manager)
245 245
     {
246
-        $jobPoster = new JobPoster();
246
+        $jobPoster = new JobPoster ();
247 247
         $jobPoster->manager_id = $manager->id;
248 248
 
249 249
         // Save manager-specific info to the job poster - equivalent to the intro step of the JPB
250
-        $divisionEn = $manager->translate('en') !== null ? $manager->translate('en')->division : null;
251
-        $divisionFr = $manager->translate('fr') !== null ? $manager->translate('fr')->division : null;
252
-        $jobPoster->fill([
250
+        $divisionEn = $manager->translate ('en') !== null ? $manager->translate ('en')->division : null;
251
+        $divisionFr = $manager->translate ('fr') !== null ? $manager->translate ('fr')->division : null;
252
+        $jobPoster->fill ([
253 253
             'department_id' => $manager->department_id,
254 254
             'en' => ['division' => $divisionEn],
255 255
             'fr' => ['division' => $divisionFr],
256 256
         ]);
257 257
 
258
-        $jobPoster->save();
258
+        $jobPoster->save ();
259 259
 
260
-        return redirect()->route('manager.jobs.edit', $jobPoster->id);
260
+        return redirect ()->route ('manager.jobs.edit', $jobPoster->id);
261 261
     }
262 262
 
263 263
     /**
@@ -272,19 +272,19 @@  discard block
 block discarded – undo
272 272
     {
273 273
         // Don't allow edits for published Job Posters
274 274
         // Also check auth while we're at it.
275
-        $this->authorize('update', $jobPoster);
276
-        JobPosterValidator::validateUnpublished($jobPoster);
275
+        $this->authorize ('update', $jobPoster);
276
+        JobPosterValidator::validateUnpublished ($jobPoster);
277 277
 
278
-        $input = $request->input();
278
+        $input = $request->input ();
279 279
 
280 280
         if ($jobPoster->manager_id == null) {
281
-            $jobPoster->manager_id = $request->user()->manager->id;
282
-            $jobPoster->save();
281
+            $jobPoster->manager_id = $request->user ()->manager->id;
282
+            $jobPoster->save ();
283 283
         }
284 284
 
285
-        $this->fillAndSaveJobPosterQuestions($input, $jobPoster, true);
285
+        $this->fillAndSaveJobPosterQuestions ($input, $jobPoster, true);
286 286
 
287
-        return redirect(route('manager.jobs.show', $jobPoster->id));
287
+        return redirect (route ('manager.jobs.show', $jobPoster->id));
288 288
     }
289 289
 
290 290
     /**
@@ -298,17 +298,17 @@  discard block
 block discarded – undo
298 298
     protected function fillAndSaveJobPosterQuestions(array $input, JobPoster $jobPoster, bool $replace) : void
299 299
     {
300 300
         if ($replace) {
301
-            $jobPoster->job_poster_questions()->delete();
301
+            $jobPoster->job_poster_questions ()->delete ();
302 302
         }
303 303
 
304
-        if (!array_key_exists('question', $input) || !is_array($input['question'])) {
304
+        if (!array_key_exists ('question', $input) || !is_array ($input['question'])) {
305 305
             return;
306 306
         }
307 307
 
308 308
         foreach ($input['question'] as $question) {
309
-            $jobQuestion = new JobPosterQuestion();
309
+            $jobQuestion = new JobPosterQuestion ();
310 310
             $jobQuestion->job_poster_id = $jobPoster->id;
311
-            $jobQuestion->fill(
311
+            $jobQuestion->fill (
312 312
                 [
313 313
                     'en' => [
314 314
                         'question' => $question['question']['en'],
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
                     ]
321 321
                 ]
322 322
             );
323
-            $jobPoster->save();
324
-            $jobQuestion->save();
323
+            $jobPoster->save ();
324
+            $jobQuestion->save ();
325 325
         }
326 326
     }
327 327
 
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
     protected function populateDefaultQuestions()
334 334
     {
335 335
         $defaultQuestions = [
336
-            'en' => array_values(Lang::get('manager/job_create', [], 'en')['questions']),
337
-            'fr' => array_values(Lang::get('manager/job_create', [], 'fr')['questions']),
336
+            'en' => array_values (Lang::get ('manager/job_create', [], 'en')['questions']),
337
+            'fr' => array_values (Lang::get ('manager/job_create', [], 'fr')['questions']),
338 338
         ];
339 339
 
340
-        if (count($defaultQuestions['en']) !== count($defaultQuestions['fr'])) {
341
-            Log::warning('There must be the same number of French and English default questions for a Job Poster.');
340
+        if (count ($defaultQuestions['en']) !== count ($defaultQuestions['fr'])) {
341
+            Log::warning ('There must be the same number of French and English default questions for a Job Poster.');
342 342
             return;
343 343
         }
344 344
 
345 345
         $jobQuestions = [];
346 346
 
347
-        for ($i = 0; $i < count($defaultQuestions['en']); $i++) {
348
-            $jobQuestion = new JobPosterQuestion();
349
-            $jobQuestion->fill(
347
+        for ($i = 0; $i < count ($defaultQuestions['en']); $i++) {
348
+            $jobQuestion = new JobPosterQuestion ();
349
+            $jobQuestion->fill (
350 350
                 [
351 351
                     'en' => [
352 352
                         'question' => $defaultQuestions['en'][$i],
Please login to merge, or discard this patch.
app/Http/Controllers/ManagerProfileController.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function show(Request $request, Manager $manager)
28 28
     {
29
-        $manager_profile = Lang::get('applicant/manager_profile');
29
+        $manager_profile = Lang::get ('applicant/manager_profile');
30 30
 
31 31
         $manager_profile_sections = [
32 32
             [
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             ]
66 66
         ];
67 67
 
68
-        return view('applicant/manager', [
68
+        return view ('applicant/manager', [
69 69
             'manager_profile' => $manager_profile,
70
-            'urls' => Lang::get('common/urls'),
70
+            'urls' => Lang::get ('common/urls'),
71 71
             'manager' => $manager,
72 72
             'manager_profile_photo_url' => '/images/user.png', // TODO get real photo.
73 73
             'manager_profile_sections' => $manager_profile_sections,
@@ -83,8 +83,8 @@  discard block
 block discarded – undo
83 83
      */
84 84
     public function editAuthenticated(Request $request)
85 85
     {
86
-        $manager = $request->user()->manager;
87
-        return redirect(route('manager.profile.edit', $manager));
86
+        $manager = $request->user ()->manager;
87
+        return redirect (route ('manager.profile.edit', $manager));
88 88
     }
89 89
 
90 90
     /**
@@ -99,25 +99,25 @@  discard block
 block discarded – undo
99 99
         // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model.
100 100
         $workplacePhotos = [];
101 101
 
102
-        $frequencies = Frequency::all();
102
+        $frequencies = Frequency::all ();
103 103
         $linkedInUrlPattern = LinkedInUrlRule::PATTERN;
104 104
         $twitterHandlePattern = TwitterHandleRule::PATTERN;
105 105
 
106
-        return view('manager/profile', [
106
+        return view ('manager/profile', [
107 107
             // Localization.
108
-            'profile_l10n' => Lang::get('manager/profile'),
108
+            'profile_l10n' => Lang::get ('manager/profile'),
109 109
             // Data.
110
-            'urls' => Lang::get('common/urls'),
110
+            'urls' => Lang::get ('common/urls'),
111 111
             'user' => $manager->user,
112 112
             'manager' => $manager,
113 113
             'manager_profile_photo_url' => '/images/user.png', // TODO get real photo.
114 114
             'workplace_photos' => $workplacePhotos,
115
-            'departments' => Department::all(),
115
+            'departments' => Department::all (),
116 116
             'telework_options' => $frequencies,
117 117
             'flex_hour_options' => $frequencies,
118 118
             'radio_options' => $frequencies,
119
-            'managerEN' => $manager->translate('en'),
120
-            'managerFR' => $manager->translate('fr'),
119
+            'managerEN' => $manager->translate ('en'),
120
+            'managerFR' => $manager->translate ('fr'),
121 121
             'linkedInUrlPattern' => $linkedInUrlPattern,
122 122
             'twitterHandlePattern' => $twitterHandlePattern,
123 123
         ]);
@@ -134,27 +134,27 @@  discard block
 block discarded – undo
134 134
     {
135 135
         // TODO: save workplace Photos.
136 136
         // TODO: remove control of name in production.
137
-        $input = $request->input();
137
+        $input = $request->input ();
138 138
 
139 139
         // redirect to error messages element if validation fails
140
-        if (isset($request->validator) && $request->validator->fails()) {
140
+        if (isset($request->validator) && $request->validator->fails ()) {
141 141
             $hash = '#managerProfileFormErrors';
142
-            return redirect(route('manager.profile.edit', $manager).$hash)
143
-                        ->withErrors($request->validator)
144
-                        ->withInput();
142
+            return redirect (route ('manager.profile.edit', $manager).$hash)
143
+                        ->withErrors ($request->validator)
144
+                        ->withInput ();
145 145
         }
146 146
 
147
-        $validated = $request->validated();
147
+        $validated = $request->validated ();
148 148
 
149 149
         $user = $manager->user;
150
-        $user->fill($validated);
150
+        $user->fill ($validated);
151 151
         if (!empty($input['new_password'])) {
152
-            $user->password = Hash::make($input['new_password']);
152
+            $user->password = Hash::make ($input['new_password']);
153 153
         }
154
-        $user->save();
154
+        $user->save ();
155 155
 
156
-        $manager->fill($validated);
157
-        $manager->save();
156
+        $manager->fill ($validated);
157
+        $manager->save ();
158 158
 
159 159
         // Use the button that was clicked to decide which element to redirect to.
160 160
         switch ($input['submit']) {
@@ -172,18 +172,18 @@  discard block
 block discarded – undo
172 172
                 break;
173 173
         }
174 174
 
175
-        return redirect(route('manager.profile.edit', $manager).$hash);
175
+        return redirect (route ('manager.profile.edit', $manager).$hash);
176 176
     }
177 177
 
178 178
     public function faq(Request $request)
179 179
     {
180
-        $show_demo_notification = $request->user() && $request->user()->isDemoManager();
180
+        $show_demo_notification = $request->user () && $request->user ()->isDemoManager ();
181 181
 
182
-        return view(
182
+        return view (
183 183
             'applicant/static_faq',
184 184
             [
185
-                'breadcrumb_home' => route('manager.home'),
186
-                'faq' => Lang::get('applicant/faq'),
185
+                'breadcrumb_home' => route ('manager.home'),
186
+                'faq' => Lang::get ('applicant/faq'),
187 187
                 'manager_sidebar_active' => 'active',
188 188
                 'show_demo_notification' => $show_demo_notification,
189 189
             ]
Please login to merge, or discard this patch.
app/Http/Controllers/Api/JobApiController.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public function __construct()
23 23
     {
24 24
         // This applies the appropriate policy to each resource route.
25
-        $this->authorizeResource(JobPoster::class, 'job');
25
+        $this->authorizeResource (JobPoster::class, 'job');
26 26
     }
27 27
 
28 28
     /**
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
35 35
      */
36 36
     private function jobToArray(JobPoster $job)
37 37
     {
38
-        $criteria = Criteria::where('job_poster_id', $job->id)->get();
38
+        $criteria = Criteria::where ('job_poster_id', $job->id)->get ();
39 39
 
40
-        $toApiArray = function ($model) {
41
-            return array_merge($model->toArray(), $model->getTranslationsArray());
40
+        $toApiArray = function ($model){
41
+            return array_merge ($model->toArray (), $model->getTranslationsArray ());
42 42
         };
43
-        $criteriaTranslated = $criteria->map($toApiArray);
43
+        $criteriaTranslated = $criteria->map ($toApiArray);
44 44
 
45
-        $jobArray = array_merge($job->toApiArray(), ['criteria' => $criteriaTranslated]);
45
+        $jobArray = array_merge ($job->toApiArray (), ['criteria' => $criteriaTranslated]);
46 46
         return $jobArray;
47 47
     }
48 48
     /**
@@ -63,14 +63,14 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function store(StoreJobPoster $request)
65 65
     {
66
-        $data = $request->validated();
67
-        $job = new JobPoster();
68
-        $job->manager_id = $request->user()->manager->id;
66
+        $data = $request->validated ();
67
+        $job = new JobPoster ();
68
+        $job->manager_id = $request->user ()->manager->id;
69 69
         // Defaulting JPB created Jobs to monthly terms for now.
70
-        $job->job_term_id = JobTerm::where('name', 'month')->value('id');
71
-        $job->fill($data);
72
-        $job->save();
73
-        return response()->json($this->jobToArray($job));
70
+        $job->job_term_id = JobTerm::where ('name', 'month')->value ('id');
71
+        $job->fill ($data);
72
+        $job->save ();
73
+        return response ()->json ($this->jobToArray ($job));
74 74
     }
75 75
 
76 76
     /**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
      */
82 82
     public function show(JobPoster $job)
83 83
     {
84
-        return response()->json($this->jobToArray($job));
84
+        return response ()->json ($this->jobToArray ($job));
85 85
     }
86 86
 
87 87
     /**
@@ -93,14 +93,14 @@  discard block
 block discarded – undo
93 93
      */
94 94
     public function update(UpdateJobPoster $request, JobPoster $job)
95 95
     {
96
-        $data = $request->validated();
96
+        $data = $request->validated ();
97 97
         // Only values both in the JobPoster->fillable array,
98 98
         // and returned by UpdateJobPoster->validatedData(), will be set.
99
-        $job->fill($data);
99
+        $job->fill ($data);
100 100
         // Defaulting JPB updated jobs to monthly for now.
101
-        $job->job_term_id = JobTerm::where('name', 'month')->value('id');
102
-        $job->save();
103
-        return response()->json($this->jobToArray($job->fresh()));
101
+        $job->job_term_id = JobTerm::where ('name', 'month')->value ('id');
102
+        $job->save ();
103
+        return response ()->json ($this->jobToArray ($job->fresh ()));
104 104
     }
105 105
 
106 106
     /**
@@ -125,18 +125,18 @@  discard block
 block discarded – undo
125 125
         // Check to avoid submitting for review multiple times.
126 126
         if ($job->review_requested_at === null) {
127 127
             // Update review request timestamp.
128
-            $job->review_requested_at = new Date();
129
-            $job->save();
128
+            $job->review_requested_at = new Date ();
129
+            $job->save ();
130 130
 
131 131
             // Send email.
132
-            $reviewer_email = config('mail.reviewer_email');
132
+            $reviewer_email = config ('mail.reviewer_email');
133 133
             if (isset($reviewer_email)) {
134
-                Mail::to($reviewer_email)->send(new JobPosterReviewRequested($job, Auth::user()));
134
+                Mail::to ($reviewer_email)->send (new JobPosterReviewRequested ($job, Auth::user ()));
135 135
             } else {
136
-                Log::error('The reviewer email environment variable is not set.');
136
+                Log::error ('The reviewer email environment variable is not set.');
137 137
             }
138 138
         }
139 139
 
140
-        return response()->json($this->jobToArray($job));
140
+        return response ()->json ($this->jobToArray ($job));
141 141
     }
142 142
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/JobTaskController.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -17,14 +17,14 @@  discard block
 block discarded – undo
17 17
      */
18 18
     public function toApiArray(JobPosterKeyTask $model)
19 19
     {
20
-        return array_merge($model->toArray(), $model->getTranslationsArray());
20
+        return array_merge ($model->toArray (), $model->getTranslationsArray ());
21 21
     }
22 22
 
23 23
     public function indexByJob(JobPoster $jobPoster)
24 24
     {
25 25
         $toApiArray = array($this, 'toApiArray');
26
-        $taskArray = JobPosterKeyTask::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray);
27
-        return response()->json($taskArray);
26
+        $taskArray = JobPosterKeyTask::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray);
27
+        return response ()->json ($taskArray);
28 28
     }
29 29
 
30 30
     /**
@@ -38,35 +38,35 @@  discard block
 block discarded – undo
38 38
     {
39 39
         $toApiArray = array($this, 'toApiArray');
40 40
 
41
-        $newTasks = collect($request->validated()); // Collection of JobPosterKeyTasks.
41
+        $newTasks = collect ($request->validated ()); // Collection of JobPosterKeyTasks.
42 42
         $oldTasks = $jobPoster->job_poster_key_tasks;
43 43
 
44 44
         $savedNewTaskIds = [];
45 45
 
46 46
         // First, delete old tasks that weren't resubmitted, and update those that were.
47 47
         foreach ($oldTasks as $task) {
48
-            $newTask = $newTasks->firstWhere('id', $task['id']);
48
+            $newTask = $newTasks->firstWhere ('id', $task['id']);
49 49
             if ($newTask) {
50 50
                 $savedNewTaskIds[] = $newTask['id'];
51
-                $task->fill(collect($newTask)->only(['en', 'fr'])->toArray());
52
-                $task->save();
51
+                $task->fill (collect ($newTask)->only (['en', 'fr'])->toArray ());
52
+                $task->save ();
53 53
             } else {
54
-                $task->delete();
54
+                $task->delete ();
55 55
             }
56 56
         }
57 57
 
58 58
         // Now, save any new tasks that remain.
59 59
         foreach ($newTasks as $task) {
60
-            if ($this->isUnsaved($task, $savedNewTaskIds)) {
61
-                $jobPosterTask = new JobPosterKeyTask();
60
+            if ($this->isUnsaved ($task, $savedNewTaskIds)) {
61
+                $jobPosterTask = new JobPosterKeyTask ();
62 62
                 $jobPosterTask->job_poster_id = $jobPoster->id;
63
-                $jobPosterTask->fill(collect($task)->only(['en', 'fr'])->toArray());
64
-                $jobPosterTask->save();
63
+                $jobPosterTask->fill (collect ($task)->only (['en', 'fr'])->toArray ());
64
+                $jobPosterTask->save ();
65 65
             }
66 66
         }
67 67
 
68
-        $taskArray = $jobPoster->fresh()->job_poster_key_tasks->map($toApiArray);
69
-        return response()->json($taskArray);
68
+        $taskArray = $jobPoster->fresh ()->job_poster_key_tasks->map ($toApiArray);
69
+        return response ()->json ($taskArray);
70 70
     }
71 71
 
72 72
     /**
@@ -78,6 +78,6 @@  discard block
 block discarded – undo
78 78
      */
79 79
     private function isUnsaved($task, array $savedTaskIds): bool
80 80
     {
81
-        return !array_key_exists('id', $task) || !in_array($task['id'], $savedTaskIds);
81
+        return !array_key_exists ('id', $task) || !in_array ($task['id'], $savedTaskIds);
82 82
     }
83 83
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/ClaimJobApiController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
      */
28 28
     public function store(Request $request, JobPoster $job)
29 29
     {
30
-        $this->claimJob($request->user()->hr_advisor, $job);
30
+        $this->claimJob ($request->user ()->hr_advisor, $job);
31 31
 
32
-        return response()->json(['status' => 'ok']);
32
+        return response ()->json (['status' => 'ok']);
33 33
     }
34 34
 
35 35
     /**
@@ -62,9 +62,9 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function destroy(Request $request, JobPoster $job)
64 64
     {
65
-        $this->unclaimJob($request->user()->hr_advisor, $job);
65
+        $this->unclaimJob ($request->user ()->hr_advisor, $job);
66 66
 
67
-        return response()->json(['status' => 'ok']);
67
+        return response ()->json (['status' => 'ok']);
68 68
     }
69 69
 
70 70
     /**
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      */
77 77
     public function claimJob(HrAdvisor $hrAdvisor, JobPoster $job)
78 78
     {
79
-        $hrAdvisor->claimed_jobs()->attach($job);
79
+        $hrAdvisor->claimed_jobs ()->attach ($job);
80 80
     }
81 81
 
82 82
     /**
@@ -88,6 +88,6 @@  discard block
 block discarded – undo
88 88
      */
89 89
     public function unclaimJob(HrAdvisor $hrAdvisor, JobPoster $job)
90 90
     {
91
-        $hrAdvisor->claimed_jobs()->detach($job);
91
+        $hrAdvisor->claimed_jobs ()->detach ($job);
92 92
     }
93 93
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Api/CriteriaController.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      */
20 20
     public function toApiArray(Criteria $model)
21 21
     {
22
-        return array_merge($model->toArray(), $model->getTranslationsArray());
22
+        return array_merge ($model->toArray (), $model->getTranslationsArray ());
23 23
     }
24 24
 
25 25
     /**
@@ -31,8 +31,8 @@  discard block
 block discarded – undo
31 31
     public function indexByJob(JobPoster $jobPoster)
32 32
     {
33 33
         $toApiArray = array($this, 'toApiArray');
34
-        $criteriaAray = Criteria::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray);
35
-        return response()->json($criteriaAray);
34
+        $criteriaAray = Criteria::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray);
35
+        return response ()->json ($criteriaAray);
36 36
     }
37 37
 
38 38
     /**
@@ -46,39 +46,39 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $toApiArray = array($this, 'toApiArray');
48 48
 
49
-        $newCriteria = collect($request->input()); // TODO: switch to validated
49
+        $newCriteria = collect ($request->input ()); // TODO: switch to validated
50 50
         $oldCriteria = $jobPoster->criteria;
51 51
 
52 52
         $updatedIds = [];
53 53
 
54 54
         // First, delete old criteria that weren't resubmitted, and update those that were
55 55
         foreach ($oldCriteria as $criteria) {
56
-            $newData = $newCriteria->firstWhere('id', $criteria['id']);
56
+            $newData = $newCriteria->firstWhere ('id', $criteria['id']);
57 57
             if ($newData) {
58 58
                 $updatedIds[] = $criteria->id;
59
-                $this->updateCriteria($criteria, $newData);
59
+                $this->updateCriteria ($criteria, $newData);
60 60
             } else {
61
-                $this->deleteCriteria($criteria);
61
+                $this->deleteCriteria ($criteria);
62 62
             }
63 63
         }
64 64
 
65 65
         $isUnsaved = function ($criteria, $savedIds): bool {
66
-            return !array_key_exists('id', $criteria) || !in_array($criteria['id'], $savedIds);
66
+            return !array_key_exists ('id', $criteria) || !in_array ($criteria['id'], $savedIds);
67 67
         };
68 68
 
69 69
         // Now, save any new criteria that remain
70 70
         foreach ($newCriteria as $criteriaData) {
71
-            if ($isUnsaved($criteriaData, $updatedIds)) {
72
-                $criteria = new Criteria();
71
+            if ($isUnsaved ($criteriaData, $updatedIds)) {
72
+                $criteria = new Criteria ();
73 73
                 $criteria->job_poster_id = $jobPoster->id;
74
-                $fillableData = collect($criteriaData)->except(['id', 'job_poster_id'])->toArray();
75
-                $criteria->fill($fillableData);
76
-                $this->createCriteria($criteria);
74
+                $fillableData = collect ($criteriaData)->except (['id', 'job_poster_id'])->toArray ();
75
+                $criteria->fill ($fillableData);
76
+                $this->createCriteria ($criteria);
77 77
             }
78 78
         }
79 79
 
80
-        $criteriaAray = Criteria::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray);
81
-        return response()->json($criteriaAray);
80
+        $criteriaAray = Criteria::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray);
81
+        return response ()->json ($criteriaAray);
82 82
     }
83 83
 
84 84
     /**
@@ -89,13 +89,13 @@  discard block
 block discarded – undo
89 89
      */
90 90
     protected function createCriteria(Criteria $criteria)
91 91
     {
92
-        $criteria->save();
92
+        $criteria->save ();
93 93
 
94
-        $notification = $this->makeAssessmentPlanNotification(
94
+        $notification = $this->makeAssessmentPlanNotification (
95 95
             'CREATE',
96 96
             $criteria
97 97
         );
98
-        $notification->save();
98
+        $notification->save ();
99 99
 
100 100
         return $criteria;
101 101
     }
@@ -113,19 +113,19 @@  discard block
 block discarded – undo
113 113
         if ($oldCriteria->skill_level_id != $newData['skill_level_id']
114 114
             || $oldCriteria->skill_id != $newData['skill_id']
115 115
         ) {
116
-            $notification = $this->makeAssessmentPlanNotification(
116
+            $notification = $this->makeAssessmentPlanNotification (
117 117
                 'UPDATE',
118 118
                 $oldCriteria,
119 119
                 $newData['skill_id'],
120 120
                 $newData['skill_level_id'],
121 121
                 $newData['criteria_type_id']
122 122
             );
123
-            $notification->save();
123
+            $notification->save ();
124 124
         }
125 125
         // Get just the data that can be changed
126
-        $fillableData = collect($newData)->except(['id', 'job_poster_id'])->toArray();
127
-        $oldCriteria->fill($fillableData);
128
-        $oldCriteria->save();
126
+        $fillableData = collect ($newData)->except (['id', 'job_poster_id'])->toArray ();
127
+        $oldCriteria->fill ($fillableData);
128
+        $oldCriteria->save ();
129 129
     }
130 130
 
131 131
     /**
@@ -136,15 +136,15 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function deleteCriteria(Criteria $criteria): void
138 138
     {
139
-        $notification = $notification = $this->makeAssessmentPlanNotification(
139
+        $notification = $notification = $this->makeAssessmentPlanNotification (
140 140
             'DELETE',
141 141
             $criteria
142 142
         );
143
-        $notification->save();
143
+        $notification->save ();
144 144
 
145 145
         // Delete assessments related to this criteria.
146
-        Assessment::where('criterion_id', $criteria->id)->delete();
147
-        $criteria->delete();
146
+        Assessment::where ('criterion_id', $criteria->id)->delete ();
147
+        $criteria->delete ();
148 148
     }
149 149
 
150 150
     /**
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
         $newSkillId = null,
164 164
         $newSkillLevelId = null,
165 165
         $newCriteriaTypeId = null
166
-    ) {
167
-        $notification = new AssessmentPlanNotification();
166
+    ){
167
+        $notification = new AssessmentPlanNotification ();
168 168
         $notification->job_poster_id = $criteria->job_poster_id;
169 169
         $notification->type = $type;
170 170
         $notification->criteria_id = $criteria->id;
Please login to merge, or discard this patch.
app/Http/Controllers/Api/HrAdvisorController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,6 +15,6 @@
 block discarded – undo
15 15
      */
16 16
     public function show(HrAdvisor $hrAdvisor)
17 17
     {
18
-        return response()->json($hrAdvisor->toArray());
18
+        return response ()->json ($hrAdvisor->toArray ());
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
app/Http/Requests/BatchUpdateCriteria.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,9 +29,9 @@
 block discarded – undo
29 29
     {
30 30
         return [
31 31
             '*.id' => 'present',
32
-            '*.criteria_type_id' => ['required', new ValidIdRule(CriteriaType::class)],
33
-            '*.skill_id' => ['required', new ValidIdRule(Skill::class)],
34
-            '*.skill_level_id' => ['required', new ValidIdRule(SkillLevel::class)],
32
+            '*.criteria_type_id' => ['required', new ValidIdRule (CriteriaType::class)],
33
+            '*.skill_id' => ['required', new ValidIdRule (Skill::class)],
34
+            '*.skill_level_id' => ['required', new ValidIdRule (SkillLevel::class)],
35 35
             '*.en.description' => 'nullable|string',
36 36
             '*.en.specificity' => 'nullable|string',
37 37
             '*.fr.description' => 'nullable|string',
Please login to merge, or discard this patch.