@@ -21,28 +21,28 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @return \Illuminate\Http\Response |
23 | 23 | */ |
24 | - public function index() |
|
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 | } |
@@ -52,33 +52,33 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return \Illuminate\Http\Response |
54 | 54 | */ |
55 | - public function managerIndex() |
|
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 | ]); |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | * @param \App\Models\JobPoster $jobPoster Job Poster object. |
92 | 92 | * @return \Illuminate\Http\Response |
93 | 93 | */ |
94 | - public function destroy(Request $request, JobPoster $jobPoster) |
|
94 | + public function destroy (Request $request, JobPoster $jobPoster) |
|
95 | 95 | { |
96 | - $jobPoster->delete(); |
|
96 | + $jobPoster->delete (); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | * @param \App\Models\JobPoster $jobPoster Job Poster object. |
104 | 104 | * @return \Illuminate\Http\Response |
105 | 105 | */ |
106 | - public function show(Request $request, JobPoster $jobPoster) |
|
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 |
||
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( |
|
128 | + 'essential' => $jobPoster->criteria->filter ( |
|
129 | 129 | function ($value, $key) { |
130 | 130 | return $value->criteria_type->name == 'essential'; |
131 | 131 | } |
132 | 132 | ), |
133 | - 'asset' => $jobPoster->criteria->filter( |
|
133 | + 'asset' => $jobPoster->criteria->filter ( |
|
134 | 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 |
||
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 |
||
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 |
||
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 | } |
@@ -213,24 +213,24 @@ discard block |
||
213 | 213 | * @param \App\Models\JobPoster $jobPoster Job Poster object. |
214 | 214 | * @return \Illuminate\Http\Response |
215 | 215 | */ |
216 | - public function edit(Request $request, JobPoster $jobPoster) |
|
216 | + public function edit (Request $request, JobPoster $jobPoster) |
|
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 | } |
@@ -241,23 +241,23 @@ discard block |
||
241 | 241 | * @param \App\Models\Manager $manager Incoming Manager object. |
242 | 242 | * @return \Illuminate\Http\Response Job Create view |
243 | 243 | */ |
244 | - public function createAsManager(Manager $manager) |
|
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 | /** |
@@ -268,23 +268,23 @@ discard block |
||
268 | 268 | * @param \App\Models\JobPoster $jobPoster Optional Job Poster object. |
269 | 269 | * @return \Illuminate\Http\Response |
270 | 270 | */ |
271 | - public function store(Request $request, JobPoster $jobPoster) |
|
271 | + public function store (Request $request, JobPoster $jobPoster) |
|
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 | /** |
@@ -295,20 +295,20 @@ discard block |
||
295 | 295 | * @param boolean $replace Remove existing relationships. |
296 | 296 | * @return void |
297 | 297 | */ |
298 | - protected function fillAndSaveJobPosterQuestions(array $input, JobPoster $jobPoster, bool $replace) : void |
|
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 |
||
320 | 320 | ] |
321 | 321 | ] |
322 | 322 | ); |
323 | - $jobPoster->save(); |
|
324 | - $jobQuestion->save(); |
|
323 | + $jobPoster->save (); |
|
324 | + $jobQuestion->save (); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
@@ -330,23 +330,23 @@ discard block |
||
330 | 330 | * |
331 | 331 | * @return mixed[]|void |
332 | 332 | */ |
333 | - protected function populateDefaultQuestions() |
|
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], |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @param \App\Models\Applicant $applicant Incoming Applicant object. |
28 | 28 | * @return \Illuminate\Http\Response |
29 | 29 | */ |
30 | - public function show(Request $request, Applicant $applicant) |
|
30 | + public function show (Request $request, Applicant $applicant) |
|
31 | 31 | { |
32 | 32 | /* |
33 | 33 | * TODO: |
@@ -41,11 +41,11 @@ discard block |
||
41 | 41 | * description // Question description text |
42 | 42 | */ |
43 | 43 | |
44 | - return view( |
|
44 | + return view ( |
|
45 | 45 | 'manager/applicant_profile', |
46 | 46 | [ |
47 | 47 | // Localization Strings. |
48 | - 'profile' => Lang::get('manager/applicant_profile'), // Change text |
|
48 | + 'profile' => Lang::get ('manager/applicant_profile'), // Change text |
|
49 | 49 | // User Data. |
50 | 50 | 'user' => $applicant->user, |
51 | 51 | 'applicant' => $applicant, |
@@ -60,10 +60,10 @@ discard block |
||
60 | 60 | * @param \Illuminate\Http\Request $request Incoming request. |
61 | 61 | * @return \Illuminate\Http\Response |
62 | 62 | */ |
63 | - public function editAuthenticated(Request $request) |
|
63 | + public function editAuthenticated (Request $request) |
|
64 | 64 | { |
65 | - $applicant = $request->user()->applicant; |
|
66 | - return redirect(route('profile.about.edit', $applicant)); |
|
65 | + $applicant = $request->user ()->applicant; |
|
66 | + return redirect (route ('profile.about.edit', $applicant)); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | * @param \App\Models\Applicant $applicant Applicant to view and edit. |
74 | 74 | * @return \Illuminate\Http\Response |
75 | 75 | */ |
76 | - public function edit(Request $request, Applicant $applicant) |
|
76 | + public function edit (Request $request, Applicant $applicant) |
|
77 | 77 | { |
78 | - $profileQuestions = ApplicantProfileQuestion::all(); |
|
78 | + $profileQuestions = ApplicantProfileQuestion::all (); |
|
79 | 79 | |
80 | - $profileText = Lang::get('applicant/applicant_profile'); |
|
80 | + $profileText = Lang::get ('applicant/applicant_profile'); |
|
81 | 81 | |
82 | 82 | $profileQuestionForms = []; |
83 | 83 | foreach ($profileQuestions as $question) { |
84 | 84 | $answerObj = $applicant->applicant_profile_answers |
85 | - ->where('applicant_profile_question_id', $question->id)->first(); |
|
85 | + ->where ('applicant_profile_question_id', $question->id)->first (); |
|
86 | 86 | $answer = $answerObj ? $answerObj->answer : null; |
87 | 87 | |
88 | 88 | $formValues = [ |
@@ -93,13 +93,13 @@ discard block |
||
93 | 93 | 'answer_label' => $profileText['about_section']['answer_label'], |
94 | 94 | 'input_name' => $this->answerFormInputName.'['.$question->id.']' |
95 | 95 | ]; |
96 | - array_push($profileQuestionForms, $formValues); |
|
96 | + array_push ($profileQuestionForms, $formValues); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | $linkedInUrlPattern = LinkedInUrlRule::PATTERN; |
100 | 100 | $twitterHandlePattern = TwitterHandleRule::PATTERN; |
101 | 101 | |
102 | - return view( |
|
102 | + return view ( |
|
103 | 103 | 'applicant/profile_01_about', |
104 | 104 | [ |
105 | 105 | // Localized strings. |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'user' => $applicant->user, |
111 | 111 | 'applicant' => $applicant, |
112 | 112 | 'profile_photo_url' => '/images/user.png', // TODO: get real photos. |
113 | - 'form_submit_action' => route('profile.about.update', $applicant), |
|
113 | + 'form_submit_action' => route ('profile.about.update', $applicant), |
|
114 | 114 | 'linkedInUrlPattern' => $linkedInUrlPattern, |
115 | 115 | 'twitterHandlePattern' => $twitterHandlePattern, |
116 | 116 | ] |
@@ -124,44 +124,44 @@ discard block |
||
124 | 124 | * @param \App\Models\Applicant $applicant Applicant object to update. |
125 | 125 | * @return \Illuminate\Http\Response |
126 | 126 | */ |
127 | - public function update(Request $request, Applicant $applicant) |
|
127 | + public function update (Request $request, Applicant $applicant) |
|
128 | 128 | { |
129 | - $questions = ApplicantProfileQuestion::all(); |
|
129 | + $questions = ApplicantProfileQuestion::all (); |
|
130 | 130 | |
131 | - $validator = new UpdateApplicationProfileValidator($applicant); |
|
132 | - $validator->validate($request->all()); |
|
131 | + $validator = new UpdateApplicationProfileValidator ($applicant); |
|
132 | + $validator->validate ($request->all ()); |
|
133 | 133 | |
134 | 134 | foreach ($questions as $question) { |
135 | - $answerName = $this->answerFormInputName . '.' . $question->id; |
|
136 | - if ($request->has($answerName)) { |
|
137 | - $answer = ApplicantProfileAnswer::where( |
|
135 | + $answerName = $this->answerFormInputName.'.'.$question->id; |
|
136 | + if ($request->has ($answerName)) { |
|
137 | + $answer = ApplicantProfileAnswer::where ( |
|
138 | 138 | [ |
139 | 139 | 'applicant_id' => $applicant->id, |
140 | 140 | 'applicant_profile_question_id' => $question->id |
141 | 141 | ] |
142 | - )->first(); |
|
142 | + )->first (); |
|
143 | 143 | if ($answer == null) { |
144 | - $answer = new ApplicantProfileAnswer(); |
|
145 | - $answer->applicant_id =$applicant->id; |
|
144 | + $answer = new ApplicantProfileAnswer (); |
|
145 | + $answer->applicant_id = $applicant->id; |
|
146 | 146 | $answer->applicant_profile_question_id = $question->id; |
147 | 147 | } |
148 | - $answer->answer = $request->input($answerName); |
|
149 | - $answer->save(); |
|
148 | + $answer->answer = $request->input ($answerName); |
|
149 | + $answer->save (); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | - $input = $request->input(); |
|
154 | - $applicant->fill( |
|
153 | + $input = $request->input (); |
|
154 | + $applicant->fill ( |
|
155 | 155 | [ |
156 | 156 | 'tagline' => $input['tagline'], |
157 | 157 | 'twitter_username' => $input['twitter_username'], |
158 | 158 | 'linkedin_url' => $input['linkedin_url'], |
159 | 159 | ] |
160 | 160 | ); |
161 | - $applicant->save(); |
|
161 | + $applicant->save (); |
|
162 | 162 | |
163 | 163 | $user = $applicant->user; |
164 | - $user->fill( |
|
164 | + $user->fill ( |
|
165 | 165 | [ |
166 | 166 | 'first_name' => $input['profile_first_name'], |
167 | 167 | 'last_name' => $input['profile_last_name'], |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | ] |
170 | 170 | ); |
171 | 171 | if ($input['new_password']) { |
172 | - $user->password = Hash::make($input['new_password']); // TODO: change password in seperate form! |
|
172 | + $user->password = Hash::make ($input['new_password']); // TODO: change password in seperate form! |
|
173 | 173 | } |
174 | - $user->save(); |
|
174 | + $user->save (); |
|
175 | 175 | |
176 | - return redirect()->route('profile.about.edit', $applicant); |
|
176 | + return redirect ()->route ('profile.about.edit', $applicant); |
|
177 | 177 | } |
178 | 178 | } |
@@ -12,12 +12,12 @@ |
||
12 | 12 | * Show the Job Builder mini SPA |
13 | 13 | * @return \Illuminate\Http\Response |
14 | 14 | */ |
15 | - public function show() |
|
15 | + public function show () |
|
16 | 16 | { |
17 | - return view( |
|
17 | + return view ( |
|
18 | 18 | 'manager/job-builder-root' |
19 | - )->with([ |
|
20 | - 'title' => Lang::get('manager/job_builder.title'), |
|
19 | + )->with ([ |
|
20 | + 'title' => Lang::get ('manager/job_builder.title'), |
|
21 | 21 | ]); |
22 | 22 | } |
23 | 23 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | * @param \App\Models\Course $course Incoming Course. |
15 | 15 | * @return \Illuminate\Http\Response |
16 | 16 | */ |
17 | - public function destroy(Request $request, Course $course) |
|
17 | + public function destroy (Request $request, Course $course) |
|
18 | 18 | { |
19 | - $this->authorize('delete', $course); |
|
20 | - $course->delete(); |
|
19 | + $this->authorize ('delete', $course); |
|
20 | + $course->delete (); |
|
21 | 21 | |
22 | - if ($request->ajax()) { |
|
22 | + if ($request->ajax ()) { |
|
23 | 23 | return [ |
24 | 24 | 'message' => 'Course delete', |
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | |
28 | - return back(); |
|
28 | + return back (); |
|
29 | 29 | } |
30 | 30 | } |
@@ -14,17 +14,17 @@ |
||
14 | 14 | * @param \App\Models\Degree $degree Incoming Degree. |
15 | 15 | * @return \Illuminate\Http\Response |
16 | 16 | */ |
17 | - public function destroy(Request $request, Degree $degree) |
|
17 | + public function destroy (Request $request, Degree $degree) |
|
18 | 18 | { |
19 | - $this->authorize('delete', $degree); |
|
20 | - $degree->delete(); |
|
19 | + $this->authorize ('delete', $degree); |
|
20 | + $degree->delete (); |
|
21 | 21 | |
22 | - if ($request->ajax()) { |
|
22 | + if ($request->ajax ()) { |
|
23 | 23 | return [ |
24 | 24 | 'message' => 'Degree deleted', |
25 | 25 | ]; |
26 | 26 | } |
27 | 27 | |
28 | - return back(); |
|
28 | + return back (); |
|
29 | 29 | } |
30 | 30 | } |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | * @param \App\Models\Manager $manager Incoming Manager. |
25 | 25 | * @return \Illuminate\Http\Response |
26 | 26 | */ |
27 | - public function show(Request $request, Manager $manager) |
|
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 |
||
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, |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @param \Illuminate\Http\Request $request Incoming Request. |
82 | 82 | * @return \Illuminate\Http\Response |
83 | 83 | */ |
84 | - public function editAuthenticated(Request $request) |
|
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 | /** |
@@ -94,30 +94,30 @@ discard block |
||
94 | 94 | * @param \App\Models\Manager $manager Incoming Manager. |
95 | 95 | * @return \Illuminate\Http\Response |
96 | 96 | */ |
97 | - public function edit(Request $request, Manager $manager) |
|
97 | + public function edit (Request $request, Manager $manager) |
|
98 | 98 | { |
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 | ]); |
@@ -130,31 +130,31 @@ discard block |
||
130 | 130 | * @param \App\Models\Manager $manager Incoming Manager. |
131 | 131 | * @return \Illuminate\Http\Response |
132 | 132 | */ |
133 | - public function update(UpdateManagerProfileRequest $request, Manager $manager) |
|
133 | + public function update (UpdateManagerProfileRequest $request, Manager $manager) |
|
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 |
||
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 | - public function faq(Request $request) |
|
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 | ] |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | /** |
14 | 14 | * Class constructor. |
15 | 15 | */ |
16 | - public function __construct() |
|
16 | + public function __construct () |
|
17 | 17 | { |
18 | 18 | // This applies the appropriate policy to each resource route. |
19 | - $this->authorizeResource(Manager::class, 'manager'); |
|
19 | + $this->authorizeResource (Manager::class, 'manager'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @return \Illuminate\Http\Response |
26 | 26 | */ |
27 | - public function index() |
|
27 | + public function index () |
|
28 | 28 | { |
29 | 29 | // TODO: complete. |
30 | 30 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param \Illuminate\Http\Request $request Incoming Request. |
36 | 36 | * @return \Illuminate\Http\Response |
37 | 37 | */ |
38 | - public function store(Request $request) |
|
38 | + public function store (Request $request) |
|
39 | 39 | { |
40 | 40 | // TODO: complete. |
41 | 41 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | * @param \App\Models\Manager $manager Incoming Manager. |
47 | 47 | * @return \Illuminate\Http\Response |
48 | 48 | */ |
49 | - public function show(Manager $manager) |
|
49 | + public function show (Manager $manager) |
|
50 | 50 | { |
51 | - return response()->json($manager->toApiArray()); |
|
51 | + return response ()->json ($manager->toApiArray ()); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | /** |
@@ -56,13 +56,13 @@ discard block |
||
56 | 56 | * |
57 | 57 | * @return \Illuminate\Http\Response |
58 | 58 | */ |
59 | - public function showAuthenticated() |
|
59 | + public function showAuthenticated () |
|
60 | 60 | { |
61 | - $user = Auth::user(); |
|
61 | + $user = Auth::user (); |
|
62 | 62 | if ($user !== null && $user->manager !== null) { |
63 | - return response()->json($user->manager->toApiArray()); |
|
63 | + return response ()->json ($user->manager->toApiArray ()); |
|
64 | 64 | } |
65 | - return response()->json([]); |
|
65 | + return response ()->json ([]); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | * @param \App\Models\Manager $manager Incoming Manager. |
73 | 73 | * @return \Illuminate\Http\Response |
74 | 74 | */ |
75 | - public function update(UpdateManagerApi $request, Manager $manager) |
|
75 | + public function update (UpdateManagerApi $request, Manager $manager) |
|
76 | 76 | { |
77 | - $validated = $request->validated(); |
|
78 | - $manager->fill($validated); |
|
79 | - $manager->save(); |
|
80 | - return response()->json($manager->toApiArray()); |
|
77 | + $validated = $request->validated (); |
|
78 | + $manager->fill ($validated); |
|
79 | + $manager->save (); |
|
80 | + return response ()->json ($manager->toApiArray ()); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * @param \App\Models\Manager $manager Incoming Manager. |
87 | 87 | * @return \Illuminate\Http\Response |
88 | 88 | */ |
89 | - public function destroy(Manager $manager) |
|
89 | + public function destroy (Manager $manager) |
|
90 | 90 | { |
91 | 91 | // TODO: complete. |
92 | 92 | } |
@@ -12,8 +12,8 @@ |
||
12 | 12 | * |
13 | 13 | * @return mixed |
14 | 14 | */ |
15 | - public function index() |
|
15 | + public function index () |
|
16 | 16 | { |
17 | - return Department::all()->map->toApiArray(); |
|
17 | + return Department::all ()->map->toApiArray (); |
|
18 | 18 | } |
19 | 19 | } |
@@ -15,16 +15,16 @@ discard block |
||
15 | 15 | * @param JobPosterKeyTask $model Incoming Job Poster Key Task object. |
16 | 16 | * @return array |
17 | 17 | */ |
18 | - public function toApiArray(JobPosterKeyTask $model) |
|
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 | - public function indexByJob(JobPoster $jobPoster) |
|
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 | /** |
@@ -34,39 +34,39 @@ discard block |
||
34 | 34 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
35 | 35 | * @return \Illuminate\Http\Response |
36 | 36 | */ |
37 | - public function batchUpdate(BatchUpdateJobTask $request, JobPoster $jobPoster) |
|
37 | + public function batchUpdate (BatchUpdateJobTask $request, JobPoster $jobPoster) |
|
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 | /** |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param number[] $savedTaskIds Array of saved task IDs. |
77 | 77 | * @return boolean |
78 | 78 | */ |
79 | - private function isUnsaved($task, array $savedTaskIds): bool |
|
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 | } |