@@ -42,9 +42,9 @@ discard block |
||
42 | 42 | * |
43 | 43 | * @return string |
44 | 44 | */ |
45 | - protected function redirectTo() |
|
45 | + protected function redirectTo () |
|
46 | 46 | { |
47 | - $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home'); |
|
47 | + $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home'); |
|
48 | 48 | return $redirectTo; |
49 | 49 | } |
50 | 50 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * |
54 | 54 | * @return void |
55 | 55 | */ |
56 | - public function __construct() |
|
56 | + public function __construct () |
|
57 | 57 | { |
58 | - $this->middleware('guest')->except('logout'); |
|
58 | + $this->middleware ('guest')->except ('logout'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @return \Illuminate\Http\Response |
66 | 66 | */ |
67 | - public function showLoginForm() |
|
67 | + public function showLoginForm () |
|
68 | 68 | { |
69 | - $home_url = WhichPortal::isManagerPortal() ? route('manager.home') : route('home'); |
|
69 | + $home_url = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home'); |
|
70 | 70 | |
71 | - return view('auth/login', [ |
|
72 | - 'routes' => $this->auth_routes(), |
|
73 | - 'login' => Lang::get('common/auth/login'), |
|
71 | + return view ('auth/login', [ |
|
72 | + 'routes' => $this->auth_routes (), |
|
73 | + 'login' => Lang::get ('common/auth/login'), |
|
74 | 74 | 'home_url' => $home_url, |
75 | 75 | ]); |
76 | 76 | } |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * @param \Illuminate\Http\Request $request Incoming Request object. |
83 | 83 | * @return \Illuminate\Http\Response |
84 | 84 | */ |
85 | - public function logout(Request $request) |
|
85 | + public function logout (Request $request) |
|
86 | 86 | { |
87 | - $this->guard()->logout(); |
|
87 | + $this->guard ()->logout (); |
|
88 | 88 | |
89 | - $request->session()->invalidate(); |
|
89 | + $request->session ()->invalidate (); |
|
90 | 90 | |
91 | 91 | // This causes logout to redirect to the same page as login. |
92 | - return redirect($this->redirectPath()); |
|
92 | + return redirect ($this->redirectPath ()); |
|
93 | 93 | } |
94 | 94 | } |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return string |
31 | 31 | */ |
32 | - protected function redirectTo() |
|
32 | + protected function redirectTo () |
|
33 | 33 | { |
34 | - $redirectTo = WhichPortal::isManagerPortal() ? route('manager.home') : route('home'); |
|
34 | + $redirectTo = WhichPortal::isManagerPortal () ? route('manager.home') : route ('home'); |
|
35 | 35 | return $redirectTo; |
36 | 36 | } |
37 | 37 | |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return void |
42 | 42 | */ |
43 | - public function __construct() |
|
43 | + public function __construct () |
|
44 | 44 | { |
45 | - $this->middleware('guest'); |
|
45 | + $this->middleware ('guest'); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,13 +54,13 @@ discard block |
||
54 | 54 | * @param string|null $token Validation token. |
55 | 55 | * @return \Illuminate\Http\Response |
56 | 56 | */ |
57 | - public function showResetForm(Request $request, $token = null) |
|
57 | + public function showResetForm (Request $request, $token = null) |
|
58 | 58 | { |
59 | - return view('auth.passwords.reset')->with([ |
|
59 | + return view ('auth.passwords.reset')->with ([ |
|
60 | 60 | 'token' => $token, |
61 | 61 | 'email' => $request->email, |
62 | - 'routes' => $this->auth_routes(), |
|
63 | - 'reset_password' => Lang::get('common/auth/reset_password'), |
|
62 | + 'routes' => $this->auth_routes (), |
|
63 | + 'reset_password' => Lang::get ('common/auth/reset_password'), |
|
64 | 64 | ]); |
65 | 65 | } |
66 | 66 | |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * |
71 | 71 | * @return array |
72 | 72 | */ |
73 | - protected function rules() |
|
73 | + protected function rules () |
|
74 | 74 | { |
75 | 75 | return [ |
76 | 76 | 'token' => 'required', |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | * |
91 | 91 | * @return array |
92 | 92 | */ |
93 | - protected function validationErrorMessages() |
|
93 | + protected function validationErrorMessages () |
|
94 | 94 | { |
95 | 95 | return []; |
96 | 96 | } |
@@ -15,17 +15,17 @@ discard block |
||
15 | 15 | * @throws \InvalidArgumentException For missing $expected_answer. |
16 | 16 | * @return mixed |
17 | 17 | */ |
18 | - public function store(StoreRatingGuideAnswer $request) |
|
18 | + public function store (StoreRatingGuideAnswer $request) |
|
19 | 19 | { |
20 | 20 | // Authorization handled by the FormRequest. |
21 | 21 | // Data validation handled by this line. |
22 | - $data = $request->validated(); |
|
23 | - $ratingGuideAnswer = new RatingGuideAnswer($data); |
|
24 | - $ratingGuideAnswer->save(); |
|
22 | + $data = $request->validated (); |
|
23 | + $ratingGuideAnswer = new RatingGuideAnswer ($data); |
|
24 | + $ratingGuideAnswer->save (); |
|
25 | 25 | |
26 | 26 | return [ |
27 | 27 | 'success' => "Successfully created rating guide answer $ratingGuideAnswer->id", |
28 | - 'rating_guide_answer' => $ratingGuideAnswer->toArray(), |
|
28 | + 'rating_guide_answer' => $ratingGuideAnswer->toArray (), |
|
29 | 29 | ]; |
30 | 30 | } |
31 | 31 | |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | * @param \App\Models\RatingGuideAnswer $ratingGuideAnswer Incoming object. |
36 | 36 | * @return mixed |
37 | 37 | */ |
38 | - public function show(RatingGuideAnswer $ratingGuideAnswer) |
|
38 | + public function show (RatingGuideAnswer $ratingGuideAnswer) |
|
39 | 39 | { |
40 | - $this->authorize('view', $ratingGuideAnswer); |
|
41 | - return $ratingGuideAnswer->toArray(); |
|
40 | + $this->authorize ('view', $ratingGuideAnswer); |
|
41 | + return $ratingGuideAnswer->toArray (); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | * @throws \InvalidArgumentException For empty $expected_answer. |
50 | 50 | * @return mixed |
51 | 51 | */ |
52 | - public function update(UpdateRatingGuideAnswer $request, RatingGuideAnswer $ratingGuideAnswer) |
|
52 | + public function update (UpdateRatingGuideAnswer $request, RatingGuideAnswer $ratingGuideAnswer) |
|
53 | 53 | { |
54 | 54 | // Authorization handled by the FormRequest. |
55 | 55 | // Data validation handled by this line. |
56 | - $data = $request->validated(); |
|
56 | + $data = $request->validated (); |
|
57 | 57 | |
58 | - $ratingGuideAnswer->fill($data); |
|
59 | - $ratingGuideAnswer->save(); |
|
60 | - $ratingGuideAnswer->refresh(); |
|
58 | + $ratingGuideAnswer->fill ($data); |
|
59 | + $ratingGuideAnswer->save (); |
|
60 | + $ratingGuideAnswer->refresh (); |
|
61 | 61 | return [ |
62 | 62 | 'success' => "Successfully updated rating guide answer $ratingGuideAnswer->id", |
63 | - 'rating_guide_answer' => $ratingGuideAnswer->toArray(), |
|
63 | + 'rating_guide_answer' => $ratingGuideAnswer->toArray (), |
|
64 | 64 | ]; |
65 | 65 | } |
66 | 66 | |
@@ -70,10 +70,10 @@ discard block |
||
70 | 70 | * @param \App\Models\RatingGuideAnswer $ratingGuideAnswer Incoming object. |
71 | 71 | * @return mixed |
72 | 72 | */ |
73 | - public function destroy(RatingGuideAnswer $ratingGuideAnswer) |
|
73 | + public function destroy (RatingGuideAnswer $ratingGuideAnswer) |
|
74 | 74 | { |
75 | - $this->authorize('delete', $ratingGuideAnswer); |
|
76 | - $ratingGuideAnswer->delete(); |
|
75 | + $this->authorize ('delete', $ratingGuideAnswer); |
|
76 | + $ratingGuideAnswer->delete (); |
|
77 | 77 | |
78 | 78 | return [ |
79 | 79 | 'success' => "Successfully deleted rating guide answer $ratingGuideAnswer->id" |
@@ -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 | } |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | * @param \Illuminate\Http\Request $request Incoming request. |
20 | 20 | * @return \Illuminate\Http\Response |
21 | 21 | */ |
22 | - public function editAuthenticated(Request $request) |
|
22 | + public function editAuthenticated (Request $request) |
|
23 | 23 | { |
24 | - $applicant = $request->user()->applicant; |
|
25 | - return redirect(route('profile.skills.edit', $applicant)); |
|
24 | + $applicant = $request->user ()->applicant; |
|
25 | + return redirect (route ('profile.skills.edit', $applicant)); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -32,18 +32,18 @@ discard block |
||
32 | 32 | * @param \App\Models\Applicant $applicant Applicant object. |
33 | 33 | * @return \Illuminate\Http\Response |
34 | 34 | */ |
35 | - public function edit(Request $request, Applicant $applicant) |
|
35 | + public function edit (Request $request, Applicant $applicant) |
|
36 | 36 | { |
37 | - $applicant->load([ |
|
37 | + $applicant->load ([ |
|
38 | 38 | 'skill_declarations.skill.skill_type', |
39 | 39 | 'skill_declarations.skill_status', |
40 | 40 | 'skill_declarations.skill_level', |
41 | 41 | ]); |
42 | 42 | |
43 | - return view('applicant/profile_03_skills', [ |
|
43 | + return view ('applicant/profile_03_skills', [ |
|
44 | 44 | 'applicant' => $applicant, |
45 | - 'profile' => Lang::get('applicant/profile_skills'), |
|
46 | - 'skills_modals' => Lang::get('common/skills_modals'), |
|
45 | + 'profile' => Lang::get ('applicant/profile_skills'), |
|
46 | + 'skills_modals' => Lang::get ('common/skills_modals'), |
|
47 | 47 | ]); |
48 | 48 | } |
49 | 49 | |
@@ -53,26 +53,26 @@ discard block |
||
53 | 53 | * @param \Illuminate\Http\Request $request Incoming request. |
54 | 54 | * @return \Illuminate\Http\Response|string |
55 | 55 | */ |
56 | - public function create(Request $request) |
|
56 | + public function create (Request $request) |
|
57 | 57 | { |
58 | - $this->authorize('create', SkillDeclaration::class); |
|
58 | + $this->authorize ('create', SkillDeclaration::class); |
|
59 | 59 | |
60 | - $user = $request->user(); |
|
60 | + $user = $request->user (); |
|
61 | 61 | $applicant = $user->applicant; |
62 | 62 | |
63 | 63 | // Get the default claim status id. |
64 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
64 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
65 | 65 | |
66 | 66 | // Create a new Skill Declaration |
67 | 67 | // But don't save, as it hasn't been validated yet. |
68 | - $skillDeclaration = new SkillDeclaration(); |
|
69 | - $skillDeclaration->skill_id = $request->input('skill_id'); |
|
68 | + $skillDeclaration = new SkillDeclaration (); |
|
69 | + $skillDeclaration->skill_id = $request->input ('skill_id'); |
|
70 | 70 | $skillDeclaration->skill_status_id = $claimedStatusId; |
71 | 71 | |
72 | - $applicant->skill_declarations()->save($skillDeclaration); |
|
72 | + $applicant->skill_declarations ()->save ($skillDeclaration); |
|
73 | 73 | |
74 | 74 | // Update variable fields in skill declaration. |
75 | - return $this->updateSkillDeclaration($request, $skillDeclaration); |
|
75 | + return $this->updateSkillDeclaration ($request, $skillDeclaration); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /** |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
83 | 83 | * @return \Illuminate\Http\Response|string |
84 | 84 | */ |
85 | - public function update(Request $request, SkillDeclaration $skillDeclaration) |
|
85 | + public function update (Request $request, SkillDeclaration $skillDeclaration) |
|
86 | 86 | { |
87 | - $this->authorize('update', $skillDeclaration); |
|
87 | + $this->authorize ('update', $skillDeclaration); |
|
88 | 88 | |
89 | - return $this->updateSkillDeclaration($request, $skillDeclaration); |
|
89 | + return $this->updateSkillDeclaration ($request, $skillDeclaration); |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
@@ -96,38 +96,38 @@ discard block |
||
96 | 96 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
97 | 97 | * @return \Illuminate\Http\Response|string |
98 | 98 | */ |
99 | - protected function updateSkillDeclaration(Request $request, SkillDeclaration $skillDeclaration) |
|
99 | + protected function updateSkillDeclaration (Request $request, SkillDeclaration $skillDeclaration) |
|
100 | 100 | { |
101 | 101 | // Fill variable values. |
102 | - $skillDeclaration->fill([ |
|
103 | - 'description' => $request->input('description'), |
|
104 | - 'skill_level_id' => $request->input('skill_level_id'), |
|
102 | + $skillDeclaration->fill ([ |
|
103 | + 'description' => $request->input ('description'), |
|
104 | + 'skill_level_id' => $request->input ('skill_level_id'), |
|
105 | 105 | ]); |
106 | 106 | |
107 | 107 | // Validate before saving. |
108 | - $validator = new SkillDeclarationValidator(); |
|
109 | - $validator->validate($skillDeclaration); |
|
108 | + $validator = new SkillDeclarationValidator (); |
|
109 | + $validator->validate ($skillDeclaration); |
|
110 | 110 | |
111 | 111 | // Save this skill declaration. |
112 | - $skillDeclaration->save(); |
|
112 | + $skillDeclaration->save (); |
|
113 | 113 | |
114 | 114 | // Attach relatives. |
115 | - $referenceIds = $this->getRelativeIds($request->input(), 'references'); |
|
116 | - $skillDeclaration->references()->sync($referenceIds); |
|
115 | + $referenceIds = $this->getRelativeIds ($request->input (), 'references'); |
|
116 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
117 | 117 | |
118 | - $sampleIds = $this->getRelativeIds($request->input(), 'samples'); |
|
119 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
118 | + $sampleIds = $this->getRelativeIds ($request->input (), 'samples'); |
|
119 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
120 | 120 | |
121 | 121 | // If an ajax request, return the new object. |
122 | - if ($request->ajax()) { |
|
123 | - $skillDeclaration->load('references'); |
|
124 | - $skillDeclaration->load('work_samples'); |
|
125 | - $skillDeclaration->load('skill'); |
|
126 | - $skillDeclaration->load('skill_status'); |
|
127 | - return $skillDeclaration->toJson(); |
|
122 | + if ($request->ajax ()) { |
|
123 | + $skillDeclaration->load ('references'); |
|
124 | + $skillDeclaration->load ('work_samples'); |
|
125 | + $skillDeclaration->load ('skill'); |
|
126 | + $skillDeclaration->load ('skill_status'); |
|
127 | + return $skillDeclaration->toJson (); |
|
128 | 128 | } |
129 | 129 | |
130 | - return redirect()->back(); |
|
130 | + return redirect ()->back (); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -137,15 +137,15 @@ discard block |
||
137 | 137 | * @param \App\Models\SkillDeclaration $skillDeclaration Incoming Skill Declaration. |
138 | 138 | * @return \Illuminate\Http\Response|string[] |
139 | 139 | */ |
140 | - public function destroy(Request $request, SkillDeclaration $skillDeclaration) |
|
140 | + public function destroy (Request $request, SkillDeclaration $skillDeclaration) |
|
141 | 141 | { |
142 | - $this->authorize('delete', $skillDeclaration); |
|
143 | - $skillDeclaration->delete(); |
|
142 | + $this->authorize ('delete', $skillDeclaration); |
|
143 | + $skillDeclaration->delete (); |
|
144 | 144 | |
145 | - if ($request->ajax()) { |
|
145 | + if ($request->ajax ()) { |
|
146 | 146 | return ['message' => 'Skill deleted']; |
147 | 147 | } |
148 | 148 | |
149 | - return redirect()->back(); |
|
149 | + return redirect ()->back (); |
|
150 | 150 | } |
151 | 151 | } |
@@ -32,24 +32,24 @@ discard block |
||
32 | 32 | * @param \App\Models\JobPoster $jobPoster Incoming JobPoster object. |
33 | 33 | * @return \Illuminate\Http\Response |
34 | 34 | */ |
35 | - public function index(JobPoster $jobPoster) |
|
35 | + public function index (JobPoster $jobPoster) |
|
36 | 36 | { |
37 | - $applications = $jobPoster->submitted_applications() |
|
38 | - ->with([ |
|
37 | + $applications = $jobPoster->submitted_applications () |
|
38 | + ->with ([ |
|
39 | 39 | 'veteran_status', |
40 | 40 | 'citizenship_declaration', |
41 | 41 | 'application_review', |
42 | 42 | 'applicant.user', |
43 | 43 | 'job_poster.criteria', |
44 | 44 | ]) |
45 | - ->get(); |
|
46 | - return view('manager/review_applications', [ |
|
45 | + ->get (); |
|
46 | + return view ('manager/review_applications', [ |
|
47 | 47 | // Localization Strings. |
48 | - 'jobs_l10n' => Lang::get('manager/job_index'), |
|
48 | + 'jobs_l10n' => Lang::get ('manager/job_index'), |
|
49 | 49 | // Data. |
50 | - 'job' => $jobPoster->toApiArray(), |
|
50 | + 'job' => $jobPoster->toApiArray (), |
|
51 | 51 | 'applications' => $applications, |
52 | - 'review_statuses' => ReviewStatus::all() |
|
52 | + 'review_statuses' => ReviewStatus::all () |
|
53 | 53 | ]); |
54 | 54 | } |
55 | 55 | |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | * @param \App\Models\JobPoster $jobPoster Incoming JobPoster object. |
60 | 60 | * @return mixed|\App\Models\JobApplication |
61 | 61 | */ |
62 | - protected function getApplicationFromJob(JobPoster $jobPoster) |
|
62 | + protected function getApplicationFromJob (JobPoster $jobPoster) |
|
63 | 63 | { |
64 | - $application = JobApplication::where('applicant_id', Auth::user()->applicant->id) |
|
65 | - ->where('job_poster_id', $jobPoster->id)->first(); |
|
64 | + $application = JobApplication::where ('applicant_id', Auth::user ()->applicant->id) |
|
65 | + ->where ('job_poster_id', $jobPoster->id)->first (); |
|
66 | 66 | if ($application == null) { |
67 | - $application = new JobApplication(); |
|
67 | + $application = new JobApplication (); |
|
68 | 68 | $application->job_poster_id = $jobPoster->id; |
69 | - $application->applicant_id = Auth::user()->applicant->id; |
|
70 | - $application->application_status_id = ApplicationStatus::where('name', 'draft')->firstOrFail()->id; |
|
71 | - $application->save(); |
|
69 | + $application->applicant_id = Auth::user ()->applicant->id; |
|
70 | + $application->application_status_id = ApplicationStatus::where ('name', 'draft')->firstOrFail ()->id; |
|
71 | + $application->save (); |
|
72 | 72 | } |
73 | 73 | return $application; |
74 | 74 | } |
@@ -79,34 +79,34 @@ discard block |
||
79 | 79 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
80 | 80 | * @return \Illuminate\Http\Response |
81 | 81 | */ |
82 | - public function editBasics(JobPoster $jobPoster) |
|
82 | + public function editBasics (JobPoster $jobPoster) |
|
83 | 83 | { |
84 | - $applicant = Auth::user()->applicant; |
|
85 | - $application = $this->getApplicationFromJob($jobPoster); |
|
84 | + $applicant = Auth::user ()->applicant; |
|
85 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
86 | 86 | |
87 | 87 | // Ensure user has permissions to view and update application. |
88 | - $this->authorize('view', $application); |
|
89 | - $this->authorize('update', $application); |
|
88 | + $this->authorize ('view', $application); |
|
89 | + $this->authorize ('update', $application); |
|
90 | 90 | |
91 | - return view( |
|
91 | + return view ( |
|
92 | 92 | 'applicant/application_post_01', |
93 | 93 | [ |
94 | 94 | // Application Template Data. |
95 | 95 | 'application_step' => 1, |
96 | - 'application_template' => Lang::get('applicant/application_template'), |
|
97 | - 'language_options' => PreferredLanguage::all(), |
|
98 | - 'citizenship_options' => CitizenshipDeclaration::all(), |
|
99 | - 'veteran_options' => VeteranStatus::all(), |
|
100 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
101 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
102 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
96 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
97 | + 'language_options' => PreferredLanguage::all (), |
|
98 | + 'citizenship_options' => CitizenshipDeclaration::all (), |
|
99 | + 'veteran_options' => VeteranStatus::all (), |
|
100 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
101 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
102 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
103 | 103 | // Job Data. |
104 | 104 | 'job' => $jobPoster, |
105 | 105 | // Applicant Data. |
106 | 106 | 'applicant' => $applicant, |
107 | 107 | 'job_application' => $application, |
108 | 108 | // Submission. |
109 | - 'form_submit_action' => route('job.application.update.1', $jobPoster) |
|
109 | + 'form_submit_action' => route ('job.application.update.1', $jobPoster) |
|
110 | 110 | ] |
111 | 111 | ); |
112 | 112 | } |
@@ -117,28 +117,28 @@ discard block |
||
117 | 117 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
118 | 118 | * @return \Illuminate\Http\Response |
119 | 119 | */ |
120 | - public function editExperience(JobPoster $jobPoster) |
|
120 | + public function editExperience (JobPoster $jobPoster) |
|
121 | 121 | { |
122 | - $applicant = Auth::user()->applicant; |
|
123 | - $application = $this->getApplicationFromJob($jobPoster); |
|
122 | + $applicant = Auth::user ()->applicant; |
|
123 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
124 | 124 | |
125 | 125 | // Ensure user has permissions to view and update application. |
126 | - $this->authorize('view', $application); |
|
127 | - $this->authorize('update', $application); |
|
126 | + $this->authorize ('view', $application); |
|
127 | + $this->authorize ('update', $application); |
|
128 | 128 | |
129 | - return view( |
|
129 | + return view ( |
|
130 | 130 | 'applicant/application_post_02', |
131 | 131 | [ |
132 | 132 | // Application Template Data. |
133 | 133 | 'application_step' => 2, |
134 | - 'application_template' => Lang::get('applicant/application_template'), |
|
134 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
135 | 135 | // Job Data. |
136 | 136 | 'job' => $jobPoster, |
137 | 137 | // Applicant Data. |
138 | 138 | 'applicant' => $applicant, |
139 | 139 | 'job_application' => $application, |
140 | 140 | // Submission. |
141 | - 'form_submit_action' => route('job.application.update.2', $jobPoster) |
|
141 | + 'form_submit_action' => route ('job.application.update.2', $jobPoster) |
|
142 | 142 | ] |
143 | 143 | ); |
144 | 144 | } |
@@ -149,41 +149,41 @@ discard block |
||
149 | 149 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
150 | 150 | * @return \Illuminate\Http\Response |
151 | 151 | */ |
152 | - public function editEssentialSkills(JobPoster $jobPoster) |
|
152 | + public function editEssentialSkills (JobPoster $jobPoster) |
|
153 | 153 | { |
154 | - $applicant = Auth::user()->applicant; |
|
155 | - $application = $this->getApplicationFromJob($jobPoster); |
|
154 | + $applicant = Auth::user ()->applicant; |
|
155 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
156 | 156 | |
157 | 157 | // Ensure user has permissions to view and update application. |
158 | - $this->authorize('view', $application); |
|
159 | - $this->authorize('update', $application); |
|
158 | + $this->authorize ('view', $application); |
|
159 | + $this->authorize ('update', $application); |
|
160 | 160 | |
161 | 161 | $criteria = [ |
162 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
162 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
163 | 163 | return $value->criteria_type->name == 'essential'; |
164 | 164 | }), |
165 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
165 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
166 | 166 | return $value->criteria_type->name == 'asset'; |
167 | 167 | }), |
168 | 168 | ]; |
169 | 169 | |
170 | - return view( |
|
170 | + return view ( |
|
171 | 171 | 'applicant/application_post_03', |
172 | 172 | [ |
173 | 173 | // Application Template Data. |
174 | 174 | 'application_step' => 3, |
175 | - 'application_template' => Lang::get('applicant/application_template'), |
|
175 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
176 | 176 | // Job Data. |
177 | 177 | 'job' => $jobPoster, |
178 | 178 | // Skills Data. |
179 | - 'skills' => Skill::all(), |
|
180 | - 'skill_template' => Lang::get('common/skills'), |
|
179 | + 'skills' => Skill::all (), |
|
180 | + 'skill_template' => Lang::get ('common/skills'), |
|
181 | 181 | 'criteria' => $criteria, |
182 | 182 | // Applicant Data. |
183 | 183 | 'applicant' => $applicant, |
184 | 184 | 'job_application' => $application, |
185 | 185 | // Submission. |
186 | - 'form_submit_action' => route('job.application.update.3', $jobPoster) |
|
186 | + 'form_submit_action' => route ('job.application.update.3', $jobPoster) |
|
187 | 187 | ] |
188 | 188 | ); |
189 | 189 | } |
@@ -194,41 +194,41 @@ discard block |
||
194 | 194 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
195 | 195 | * @return \Illuminate\Http\Response |
196 | 196 | */ |
197 | - public function editAssetSkills(JobPoster $jobPoster) |
|
197 | + public function editAssetSkills (JobPoster $jobPoster) |
|
198 | 198 | { |
199 | - $applicant = Auth::user()->applicant; |
|
200 | - $application = $this->getApplicationFromJob($jobPoster); |
|
199 | + $applicant = Auth::user ()->applicant; |
|
200 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
201 | 201 | |
202 | 202 | // Ensure user has permissions to view and update application. |
203 | - $this->authorize('view', $application); |
|
204 | - $this->authorize('update', $application); |
|
203 | + $this->authorize ('view', $application); |
|
204 | + $this->authorize ('update', $application); |
|
205 | 205 | |
206 | 206 | $criteria = [ |
207 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
207 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
208 | 208 | return $value->criteria_type->name == 'essential'; |
209 | 209 | }), |
210 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
210 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
211 | 211 | return $value->criteria_type->name == 'asset'; |
212 | 212 | }), |
213 | 213 | ]; |
214 | 214 | |
215 | - return view( |
|
215 | + return view ( |
|
216 | 216 | 'applicant/application_post_04', |
217 | 217 | [ |
218 | 218 | // Application Template Data. |
219 | 219 | 'application_step' => 4, |
220 | - 'application_template' => Lang::get('applicant/application_template'), |
|
220 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
221 | 221 | // Job Data. |
222 | 222 | 'job' => $jobPoster, |
223 | 223 | // Skills Data. |
224 | - 'skills' => Skill::all(), |
|
225 | - 'skill_template' => Lang::get('common/skills'), |
|
224 | + 'skills' => Skill::all (), |
|
225 | + 'skill_template' => Lang::get ('common/skills'), |
|
226 | 226 | 'criteria' => $criteria, |
227 | 227 | // Applicant Data. |
228 | 228 | 'applicant' => $applicant, |
229 | 229 | 'job_application' => $application, |
230 | 230 | // Submission. |
231 | - 'form_submit_action' => route('job.application.update.4', $jobPoster) |
|
231 | + 'form_submit_action' => route ('job.application.update.4', $jobPoster) |
|
232 | 232 | ] |
233 | 233 | ); |
234 | 234 | } |
@@ -239,40 +239,40 @@ discard block |
||
239 | 239 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
240 | 240 | * @return \Illuminate\Http\Response |
241 | 241 | */ |
242 | - public function preview(JobPoster $jobPoster) |
|
242 | + public function preview (JobPoster $jobPoster) |
|
243 | 243 | { |
244 | - $applicant = Auth::user()->applicant; |
|
245 | - $application = $this->getApplicationFromJob($jobPoster); |
|
244 | + $applicant = Auth::user ()->applicant; |
|
245 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
246 | 246 | |
247 | - $this->authorize('view', $application); |
|
247 | + $this->authorize ('view', $application); |
|
248 | 248 | $criteria = [ |
249 | - 'essential' => $jobPoster->criteria->filter(function ($value, $key) { |
|
249 | + 'essential' => $jobPoster->criteria->filter (function ($value, $key) { |
|
250 | 250 | return $value->criteria_type->name == 'essential'; |
251 | 251 | }), |
252 | - 'asset' => $jobPoster->criteria->filter(function ($value, $key) { |
|
252 | + 'asset' => $jobPoster->criteria->filter (function ($value, $key) { |
|
253 | 253 | return $value->criteria_type->name == 'asset'; |
254 | 254 | }), |
255 | 255 | ]; |
256 | 256 | |
257 | - return view( |
|
257 | + return view ( |
|
258 | 258 | 'applicant/application_post_05', |
259 | 259 | [ |
260 | 260 | // Application Template Data. |
261 | 261 | 'application_step' => 5, |
262 | - 'application_template' => Lang::get('applicant/application_template'), |
|
263 | - 'preferred_language_template' => Lang::get('common/preferred_language'), |
|
264 | - 'citizenship_declaration_template' => Lang::get('common/citizenship_declaration'), |
|
265 | - 'veteran_status_template' => Lang::get('common/veteran_status'), |
|
262 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
263 | + 'preferred_language_template' => Lang::get ('common/preferred_language'), |
|
264 | + 'citizenship_declaration_template' => Lang::get ('common/citizenship_declaration'), |
|
265 | + 'veteran_status_template' => Lang::get ('common/veteran_status'), |
|
266 | 266 | // Job Data. |
267 | 267 | 'job' => $jobPoster, |
268 | 268 | // Skills Data. |
269 | - 'skills' => Skill::all(), |
|
270 | - 'skill_template' => Lang::get('common/skills'), |
|
269 | + 'skills' => Skill::all (), |
|
270 | + 'skill_template' => Lang::get ('common/skills'), |
|
271 | 271 | 'criteria' => $criteria, |
272 | 272 | // Applicant Data. |
273 | 273 | 'applicant' => $applicant, |
274 | 274 | 'job_application' => $application, |
275 | - 'is_manager_view' => WhichPortal::isManagerPortal(), |
|
275 | + 'is_manager_view' => WhichPortal::isManagerPortal (), |
|
276 | 276 | ] |
277 | 277 | ); |
278 | 278 | } |
@@ -283,24 +283,24 @@ discard block |
||
283 | 283 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
284 | 284 | * @return \Illuminate\Http\Response |
285 | 285 | */ |
286 | - public function confirm(JobPoster $jobPoster) |
|
286 | + public function confirm (JobPoster $jobPoster) |
|
287 | 287 | { |
288 | - $applicant = Auth::user()->applicant; |
|
289 | - $application = $this->getApplicationFromJob($jobPoster); |
|
288 | + $applicant = Auth::user ()->applicant; |
|
289 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
290 | 290 | |
291 | - $this->authorize('update', $application); |
|
291 | + $this->authorize ('update', $application); |
|
292 | 292 | |
293 | - return view( |
|
293 | + return view ( |
|
294 | 294 | 'applicant/application_post_06', |
295 | 295 | [ |
296 | 296 | // Application Template Data. |
297 | 297 | 'application_step' => 6, |
298 | - 'application_template' => Lang::get('applicant/application_template'), |
|
298 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
299 | 299 | // Used by tracker partial. |
300 | 300 | 'job' => $jobPoster, |
301 | 301 | 'job_application' => $application, |
302 | 302 | // Submission. |
303 | - 'form_submit_action' => route('job.application.submit', $jobPoster) |
|
303 | + 'form_submit_action' => route ('job.application.submit', $jobPoster) |
|
304 | 304 | ] |
305 | 305 | ); |
306 | 306 | } |
@@ -311,22 +311,22 @@ discard block |
||
311 | 311 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
312 | 312 | * @return \Illuminate\Http\Response |
313 | 313 | */ |
314 | - public function complete(JobPoster $jobPoster) |
|
314 | + public function complete (JobPoster $jobPoster) |
|
315 | 315 | { |
316 | 316 | // Include Applicant Data. |
317 | - $applicant = Auth::user()->applicant; |
|
317 | + $applicant = Auth::user ()->applicant; |
|
318 | 318 | // Include Application Data. |
319 | - $application = $this->getApplicationFromJob($jobPoster); |
|
319 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
320 | 320 | |
321 | 321 | // Ensure user has permissions to view application. |
322 | - $this->authorize('view', $application); |
|
322 | + $this->authorize ('view', $application); |
|
323 | 323 | |
324 | 324 | // Return the Completion View. |
325 | - return view( |
|
325 | + return view ( |
|
326 | 326 | 'applicant/application_post_complete', |
327 | 327 | [ |
328 | 328 | // Application Template Data. |
329 | - 'application_template' => Lang::get('applicant/application_template'), |
|
329 | + 'application_template' => Lang::get ('applicant/application_template'), |
|
330 | 330 | // Job Data. |
331 | 331 | 'job' => $jobPoster, |
332 | 332 | // Applicant Data. |
@@ -343,52 +343,52 @@ discard block |
||
343 | 343 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
344 | 344 | * @return \Illuminate\Http\Response |
345 | 345 | */ |
346 | - public function updateBasics(Request $request, JobPoster $jobPoster) |
|
346 | + public function updateBasics (Request $request, JobPoster $jobPoster) |
|
347 | 347 | { |
348 | - $applicant = Auth::user()->applicant; |
|
349 | - $application = $this->getApplicationFromJob($jobPoster); |
|
348 | + $applicant = Auth::user ()->applicant; |
|
349 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
350 | 350 | |
351 | 351 | // Ensure user has permissions to update this application. |
352 | - $this->authorize('update', $application); |
|
352 | + $this->authorize ('update', $application); |
|
353 | 353 | |
354 | - $application->fill([ |
|
355 | - 'citizenship_declaration_id' => $request->input('citizenship_declaration_id'), |
|
356 | - 'veteran_status_id' => $request->input('veteran_status_id'), |
|
357 | - 'preferred_language_id' => $request->input('preferred_language_id'), |
|
358 | - 'language_requirement_confirmed' => $request->input('language_requirement_confirmed') |
|
354 | + $application->fill ([ |
|
355 | + 'citizenship_declaration_id' => $request->input ('citizenship_declaration_id'), |
|
356 | + 'veteran_status_id' => $request->input ('veteran_status_id'), |
|
357 | + 'preferred_language_id' => $request->input ('preferred_language_id'), |
|
358 | + 'language_requirement_confirmed' => $request->input ('language_requirement_confirmed') |
|
359 | 359 | ]); |
360 | - $application->save(); |
|
360 | + $application->save (); |
|
361 | 361 | |
362 | 362 | $questions = $jobPoster->job_poster_questions; |
363 | - $questionsInput = $request->input('questions'); |
|
363 | + $questionsInput = $request->input ('questions'); |
|
364 | 364 | foreach ($questions as $question) { |
365 | 365 | $answer = null; |
366 | 366 | if (isset($questionsInput[$question->id])) { |
367 | 367 | $answer = $questionsInput[$question->id]; |
368 | 368 | } |
369 | 369 | $answerObj = $application->job_application_answers |
370 | - ->firstWhere('job_poster_question_id', $question->id); |
|
370 | + ->firstWhere ('job_poster_question_id', $question->id); |
|
371 | 371 | if ($answerObj == null) { |
372 | - $answerObj = new JobApplicationAnswer(); |
|
372 | + $answerObj = new JobApplicationAnswer (); |
|
373 | 373 | $answerObj->job_poster_question_id = $question->id; |
374 | 374 | $answerObj->job_application_id = $application->id; |
375 | 375 | } |
376 | 376 | $answerObj->answer = $answer; |
377 | - $answerObj->save(); |
|
377 | + $answerObj->save (); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | // Redirect to correct page. |
381 | - switch ($request->input('submit')) { |
|
381 | + switch ($request->input ('submit')) { |
|
382 | 382 | case 'save_and_quit': |
383 | 383 | case 'previous': |
384 | - return redirect()->route('applications.index'); |
|
384 | + return redirect ()->route ('applications.index'); |
|
385 | 385 | break; |
386 | 386 | case 'save_and_continue': |
387 | 387 | case 'next': |
388 | - return redirect()->route('job.application.edit.2', $jobPoster); |
|
388 | + return redirect ()->route ('job.application.edit.2', $jobPoster); |
|
389 | 389 | break; |
390 | 390 | default: |
391 | - return redirect()->back()->withInput(); |
|
391 | + return redirect ()->back ()->withInput (); |
|
392 | 392 | } |
393 | 393 | } |
394 | 394 | |
@@ -399,21 +399,21 @@ discard block |
||
399 | 399 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
400 | 400 | * @return \Illuminate\Http\Response |
401 | 401 | */ |
402 | - public function updateExperience(Request $request, JobPoster $jobPoster) |
|
402 | + public function updateExperience (Request $request, JobPoster $jobPoster) |
|
403 | 403 | { |
404 | - $applicant = Auth::user()->applicant; |
|
405 | - $application = $this->getApplicationFromJob($jobPoster); |
|
404 | + $applicant = Auth::user ()->applicant; |
|
405 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
406 | 406 | |
407 | 407 | // Ensure user has permissions to update this application. |
408 | - $this->authorize('update', $application); |
|
408 | + $this->authorize ('update', $application); |
|
409 | 409 | |
410 | 410 | // Record that the user has saved their experience for this application. |
411 | 411 | $application->experience_saved = true; |
412 | - $application->save(); |
|
412 | + $application->save (); |
|
413 | 413 | |
414 | - $degrees = $request->input('degrees'); |
|
414 | + $degrees = $request->input ('degrees'); |
|
415 | 415 | |
416 | - $request->validate([ |
|
416 | + $request->validate ([ |
|
417 | 417 | 'degrees.new.*.degree_type_id' => 'required', |
418 | 418 | 'degrees.new.*.area_of_study' => 'required', |
419 | 419 | 'degrees.new.*.institution' => 'required', |
@@ -426,8 +426,8 @@ discard block |
||
426 | 426 | // Save new degrees. |
427 | 427 | if (isset($degrees['new'])) { |
428 | 428 | foreach ($degrees['new'] as $degreeInput) { |
429 | - $degree = new Degree(); |
|
430 | - $degree->fill([ |
|
429 | + $degree = new Degree (); |
|
430 | + $degree->fill ([ |
|
431 | 431 | 'degree_type_id' => $degreeInput['degree_type_id'], |
432 | 432 | 'area_of_study' => $degreeInput['area_of_study'], |
433 | 433 | 'institution' => $degreeInput['institution'], |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | 'end_date' => $degreeInput['end_date'], |
437 | 437 | 'blockcert_url' => $degreeInput['blockcert_url'], |
438 | 438 | ]); |
439 | - $applicant->degrees()->save($degree); |
|
439 | + $applicant->degrees ()->save ($degree); |
|
440 | 440 | } |
441 | 441 | } |
442 | 442 | |
@@ -444,9 +444,9 @@ discard block |
||
444 | 444 | if (isset($degrees['old'])) { |
445 | 445 | foreach ($degrees['old'] as $id => $degreeInput) { |
446 | 446 | // Ensure this degree belongs to this applicant. |
447 | - $degree = $applicant->degrees->firstWhere('id', $id); |
|
447 | + $degree = $applicant->degrees->firstWhere ('id', $id); |
|
448 | 448 | if ($degree != null) { |
449 | - $degree->fill([ |
|
449 | + $degree->fill ([ |
|
450 | 450 | 'degree_type_id' => $degreeInput['degree_type_id'], |
451 | 451 | 'area_of_study' => $degreeInput['area_of_study'], |
452 | 452 | 'institution' => $degreeInput['institution'], |
@@ -455,16 +455,16 @@ discard block |
||
455 | 455 | 'end_date' => $degreeInput['end_date'], |
456 | 456 | 'blockcert_url' => $degreeInput['blockcert_url'], |
457 | 457 | ]); |
458 | - $degree->save(); |
|
458 | + $degree->save (); |
|
459 | 459 | } else { |
460 | - Log::warning("Applicant $applicant->id attempted to update degree with invalid id: $id"); |
|
460 | + Log::warning ("Applicant $applicant->id attempted to update degree with invalid id: $id"); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | } |
464 | 464 | |
465 | - $courses = $request->input('courses'); |
|
465 | + $courses = $request->input ('courses'); |
|
466 | 466 | |
467 | - $request->validate([ |
|
467 | + $request->validate ([ |
|
468 | 468 | 'courses.new.*.name' => 'required', |
469 | 469 | 'courses.new.*.institution' => 'required', |
470 | 470 | 'courses.new.*.course_status_id' => 'required', |
@@ -475,15 +475,15 @@ discard block |
||
475 | 475 | // Save new courses. |
476 | 476 | if (isset($courses['new'])) { |
477 | 477 | foreach ($courses['new'] as $courseInput) { |
478 | - $course = new Course(); |
|
479 | - $course->fill([ |
|
478 | + $course = new Course (); |
|
479 | + $course->fill ([ |
|
480 | 480 | 'name' => $courseInput['name'], |
481 | 481 | 'institution' => $courseInput['institution'], |
482 | 482 | 'course_status_id' => $courseInput['course_status_id'], |
483 | 483 | 'start_date' => $courseInput['start_date'], |
484 | 484 | 'end_date' => $courseInput['end_date'] |
485 | 485 | ]); |
486 | - $applicant->courses()->save($course); |
|
486 | + $applicant->courses ()->save ($course); |
|
487 | 487 | } |
488 | 488 | } |
489 | 489 | |
@@ -491,25 +491,25 @@ discard block |
||
491 | 491 | if (isset($courses['old'])) { |
492 | 492 | foreach ($courses['old'] as $id => $courseInput) { |
493 | 493 | // Ensure this course belongs to this applicant. |
494 | - $course = $applicant->courses->firstWhere('id', $id); |
|
494 | + $course = $applicant->courses->firstWhere ('id', $id); |
|
495 | 495 | if ($course != null) { |
496 | - $course->fill([ |
|
496 | + $course->fill ([ |
|
497 | 497 | 'name' => $courseInput['name'], |
498 | 498 | 'institution' => $courseInput['institution'], |
499 | 499 | 'course_status_id' => $courseInput['course_status_id'], |
500 | 500 | 'start_date' => $courseInput['start_date'], |
501 | 501 | 'end_date' => $courseInput['end_date'] |
502 | 502 | ]); |
503 | - $course->save(); |
|
503 | + $course->save (); |
|
504 | 504 | } else { |
505 | - Log::warning("Applicant $applicant->id attempted to update course with invalid id: $id"); |
|
505 | + Log::warning ("Applicant $applicant->id attempted to update course with invalid id: $id"); |
|
506 | 506 | } |
507 | 507 | } |
508 | 508 | } |
509 | 509 | |
510 | - $work_experiences = $request->input('work_experiences'); |
|
510 | + $work_experiences = $request->input ('work_experiences'); |
|
511 | 511 | |
512 | - $request->validate([ |
|
512 | + $request->validate ([ |
|
513 | 513 | 'work_experiences.new.*.role' => 'required', |
514 | 514 | 'work_experiences.new.*.company' => 'required', |
515 | 515 | 'work_experiences.new.*.description' => 'required', |
@@ -520,15 +520,15 @@ discard block |
||
520 | 520 | // Save new work_experiences. |
521 | 521 | if (isset($work_experiences['new'])) { |
522 | 522 | foreach ($work_experiences['new'] as $workExperienceInput) { |
523 | - $workExperience = new WorkExperience(); |
|
524 | - $workExperience->fill([ |
|
523 | + $workExperience = new WorkExperience (); |
|
524 | + $workExperience->fill ([ |
|
525 | 525 | 'role' => $workExperienceInput['role'], |
526 | 526 | 'company' => $workExperienceInput['company'], |
527 | 527 | 'description' => $workExperienceInput['description'], |
528 | 528 | 'start_date' => $workExperienceInput['start_date'], |
529 | 529 | 'end_date' => $workExperienceInput['end_date'] |
530 | 530 | ]); |
531 | - $applicant->work_experiences()->save($workExperience); |
|
531 | + $applicant->work_experiences ()->save ($workExperience); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
@@ -536,36 +536,36 @@ discard block |
||
536 | 536 | if (isset($work_experiences['old'])) { |
537 | 537 | foreach ($work_experiences['old'] as $id => $workExperienceInput) { |
538 | 538 | // Ensure this work_experience belongs to this applicant. |
539 | - $workExperience = $applicant->work_experiences->firstWhere('id', $id); |
|
539 | + $workExperience = $applicant->work_experiences->firstWhere ('id', $id); |
|
540 | 540 | if ($workExperience != null) { |
541 | - $workExperience->fill([ |
|
541 | + $workExperience->fill ([ |
|
542 | 542 | 'role' => $workExperienceInput['role'], |
543 | 543 | 'company' => $workExperienceInput['company'], |
544 | 544 | 'description' => $workExperienceInput['description'], |
545 | 545 | 'start_date' => $workExperienceInput['start_date'], |
546 | 546 | 'end_date' => $workExperienceInput['end_date'] |
547 | 547 | ]); |
548 | - $workExperience->save(); |
|
548 | + $workExperience->save (); |
|
549 | 549 | } else { |
550 | - Log::warning("Applicant $applicant->id attempted to update work_experience with invalid id: $id"); |
|
550 | + Log::warning ("Applicant $applicant->id attempted to update work_experience with invalid id: $id"); |
|
551 | 551 | } |
552 | 552 | } |
553 | 553 | } |
554 | 554 | |
555 | 555 | // Redirect to correct page. |
556 | - switch ($request->input('submit')) { |
|
556 | + switch ($request->input ('submit')) { |
|
557 | 557 | case 'save_and_quit': |
558 | - return redirect()->route('applications.index'); |
|
558 | + return redirect ()->route ('applications.index'); |
|
559 | 559 | break; |
560 | 560 | case 'save_and_continue': |
561 | 561 | case 'next': |
562 | - return redirect()->route('job.application.edit.3', $jobPoster); |
|
562 | + return redirect ()->route ('job.application.edit.3', $jobPoster); |
|
563 | 563 | break; |
564 | 564 | case 'previous': |
565 | - return redirect()->route('job.application.edit.1', $jobPoster); |
|
565 | + return redirect ()->route ('job.application.edit.1', $jobPoster); |
|
566 | 566 | break; |
567 | 567 | default: |
568 | - return redirect()->back()->withInput(); |
|
568 | + return redirect ()->back ()->withInput (); |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
@@ -576,35 +576,35 @@ discard block |
||
576 | 576 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
577 | 577 | * @return \Illuminate\Http\Response |
578 | 578 | */ |
579 | - public function updateEssentialSkills(Request $request, JobPoster $jobPoster) |
|
579 | + public function updateEssentialSkills (Request $request, JobPoster $jobPoster) |
|
580 | 580 | { |
581 | - $applicant = Auth::user()->applicant; |
|
582 | - $application = $this->getApplicationFromJob($jobPoster); |
|
581 | + $applicant = Auth::user ()->applicant; |
|
582 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
583 | 583 | |
584 | 584 | // Ensure user has permissions to update this application. |
585 | - $this->authorize('update', $application); |
|
585 | + $this->authorize ('update', $application); |
|
586 | 586 | |
587 | - $skillDeclarations = $request->input('skill_declarations'); |
|
588 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
587 | + $skillDeclarations = $request->input ('skill_declarations'); |
|
588 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
589 | 589 | |
590 | 590 | // Save new skill declarartions. |
591 | 591 | if (isset($skillDeclarations['new'])) { |
592 | 592 | foreach ($skillDeclarations['new'] as $skillType => $typeInput) { |
593 | 593 | foreach ($typeInput as $criterion_id => $skillDeclarationInput) { |
594 | - $skillDeclaration = new SkillDeclaration(); |
|
595 | - $skillDeclaration->skill_id = Criteria::find($criterion_id)->skill->id; |
|
594 | + $skillDeclaration = new SkillDeclaration (); |
|
595 | + $skillDeclaration->skill_id = Criteria::find ($criterion_id)->skill->id; |
|
596 | 596 | $skillDeclaration->skill_status_id = $claimedStatusId; |
597 | - $skillDeclaration->fill([ |
|
597 | + $skillDeclaration->fill ([ |
|
598 | 598 | 'description' => $skillDeclarationInput['description'], |
599 | 599 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
600 | 600 | ]); |
601 | - $applicant->skill_declarations()->save($skillDeclaration); |
|
601 | + $applicant->skill_declarations ()->save ($skillDeclaration); |
|
602 | 602 | |
603 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
604 | - $skillDeclaration->references()->sync($referenceIds); |
|
603 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
604 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
605 | 605 | |
606 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
607 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
606 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
607 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
608 | 608 | } |
609 | 609 | } |
610 | 610 | } |
@@ -614,41 +614,41 @@ discard block |
||
614 | 614 | foreach ($skillDeclarations['old'] as $skillType => $typeInput) { |
615 | 615 | foreach ($typeInput as $id => $skillDeclarationInput) { |
616 | 616 | // Ensure this declaration belongs to this applicant. |
617 | - $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id); |
|
617 | + $skillDeclaration = $applicant->skill_declarations->firstWhere ('id', $id); |
|
618 | 618 | if ($skillDeclaration != null) { |
619 | 619 | // skill_id and skill_status cannot be changed. |
620 | - $skillDeclaration->fill([ |
|
620 | + $skillDeclaration->fill ([ |
|
621 | 621 | 'description' => $skillDeclarationInput['description'], |
622 | 622 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
623 | 623 | ]); |
624 | - $skillDeclaration->save(); |
|
624 | + $skillDeclaration->save (); |
|
625 | 625 | |
626 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
627 | - $skillDeclaration->references()->sync($referenceIds); |
|
626 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
627 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
628 | 628 | |
629 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
630 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
629 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
630 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
631 | 631 | } else { |
632 | - Log::warning("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
632 | + Log::warning ("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
633 | 633 | } |
634 | 634 | } |
635 | 635 | } |
636 | 636 | } |
637 | 637 | |
638 | 638 | // Redirect to correct page. |
639 | - switch ($request->input('submit')) { |
|
639 | + switch ($request->input ('submit')) { |
|
640 | 640 | case 'save_and_quit': |
641 | - return redirect()->route('applications.index'); |
|
641 | + return redirect ()->route ('applications.index'); |
|
642 | 642 | break; |
643 | 643 | case 'save_and_continue': |
644 | 644 | case 'next': |
645 | - return redirect()->route('job.application.edit.4', $jobPoster); |
|
645 | + return redirect ()->route ('job.application.edit.4', $jobPoster); |
|
646 | 646 | break; |
647 | 647 | case 'previous': |
648 | - return redirect()->route('job.application.edit.2', $jobPoster); |
|
648 | + return redirect ()->route ('job.application.edit.2', $jobPoster); |
|
649 | 649 | break; |
650 | 650 | default: |
651 | - return redirect()->back()->withInput(); |
|
651 | + return redirect ()->back ()->withInput (); |
|
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
@@ -659,35 +659,35 @@ discard block |
||
659 | 659 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
660 | 660 | * @return \Illuminate\Http\Response |
661 | 661 | */ |
662 | - public function updateAssetSkills(Request $request, JobPoster $jobPoster) |
|
662 | + public function updateAssetSkills (Request $request, JobPoster $jobPoster) |
|
663 | 663 | { |
664 | - $applicant = Auth::user()->applicant; |
|
665 | - $application = $this->getApplicationFromJob($jobPoster); |
|
664 | + $applicant = Auth::user ()->applicant; |
|
665 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
666 | 666 | |
667 | 667 | // Ensure user has permissions to update this application. |
668 | - $this->authorize('update', $application); |
|
668 | + $this->authorize ('update', $application); |
|
669 | 669 | |
670 | - $skillDeclarations = $request->input('skill_declarations'); |
|
671 | - $claimedStatusId = SkillStatus::where('name', 'claimed')->firstOrFail()->id; |
|
670 | + $skillDeclarations = $request->input ('skill_declarations'); |
|
671 | + $claimedStatusId = SkillStatus::where ('name', 'claimed')->firstOrFail ()->id; |
|
672 | 672 | |
673 | 673 | // Save new skill declarartions. |
674 | 674 | if (isset($skillDeclarations['new'])) { |
675 | 675 | foreach ($skillDeclarations['new'] as $skillType => $typeInput) { |
676 | 676 | foreach ($typeInput as $criterion_id => $skillDeclarationInput) { |
677 | - $skillDeclaration = new SkillDeclaration(); |
|
678 | - $skillDeclaration->skill_id = Criteria::find($criterion_id)->skill->id; |
|
677 | + $skillDeclaration = new SkillDeclaration (); |
|
678 | + $skillDeclaration->skill_id = Criteria::find ($criterion_id)->skill->id; |
|
679 | 679 | $skillDeclaration->skill_status_id = $claimedStatusId; |
680 | - $skillDeclaration->fill([ |
|
680 | + $skillDeclaration->fill ([ |
|
681 | 681 | 'description' => $skillDeclarationInput['description'], |
682 | 682 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
683 | 683 | ]); |
684 | - $applicant->skill_declarations()->save($skillDeclaration); |
|
684 | + $applicant->skill_declarations ()->save ($skillDeclaration); |
|
685 | 685 | |
686 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
687 | - $skillDeclaration->references()->sync($referenceIds); |
|
686 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
687 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
688 | 688 | |
689 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
690 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
689 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
690 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
691 | 691 | } |
692 | 692 | } |
693 | 693 | } |
@@ -697,41 +697,41 @@ discard block |
||
697 | 697 | foreach ($skillDeclarations['old'] as $skillType => $typeInput) { |
698 | 698 | foreach ($typeInput as $id => $skillDeclarationInput) { |
699 | 699 | // Ensure this declaration belongs to this applicant. |
700 | - $skillDeclaration = $applicant->skill_declarations->firstWhere('id', $id); |
|
700 | + $skillDeclaration = $applicant->skill_declarations->firstWhere ('id', $id); |
|
701 | 701 | if ($skillDeclaration != null) { |
702 | 702 | // skill_id and skill_status cannot be changed. |
703 | - $skillDeclaration->fill([ |
|
703 | + $skillDeclaration->fill ([ |
|
704 | 704 | 'description' => $skillDeclarationInput['description'], |
705 | 705 | 'skill_level_id' => isset($skillDeclarationInput['skill_level_id']) ? $skillDeclarationInput['skill_level_id'] : null, |
706 | 706 | ]); |
707 | - $skillDeclaration->save(); |
|
707 | + $skillDeclaration->save (); |
|
708 | 708 | |
709 | - $referenceIds = $this->getRelativeIds($skillDeclarationInput, 'references'); |
|
710 | - $skillDeclaration->references()->sync($referenceIds); |
|
709 | + $referenceIds = $this->getRelativeIds ($skillDeclarationInput, 'references'); |
|
710 | + $skillDeclaration->references ()->sync ($referenceIds); |
|
711 | 711 | |
712 | - $sampleIds = $this->getRelativeIds($skillDeclarationInput, 'samples'); |
|
713 | - $skillDeclaration->work_samples()->sync($sampleIds); |
|
712 | + $sampleIds = $this->getRelativeIds ($skillDeclarationInput, 'samples'); |
|
713 | + $skillDeclaration->work_samples ()->sync ($sampleIds); |
|
714 | 714 | } else { |
715 | - Log::warning("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
715 | + Log::warning ("Applicant $applicant->id attempted to update skill declaration with invalid id: $id"); |
|
716 | 716 | } |
717 | 717 | } |
718 | 718 | } |
719 | 719 | } |
720 | 720 | |
721 | 721 | // Redirect to correct page. |
722 | - switch ($request->input('submit')) { |
|
722 | + switch ($request->input ('submit')) { |
|
723 | 723 | case 'save_and_quit': |
724 | - return redirect()->route('applications.index'); |
|
724 | + return redirect ()->route ('applications.index'); |
|
725 | 725 | break; |
726 | 726 | case 'save_and_continue': |
727 | 727 | case 'next': |
728 | - return redirect()->route('job.application.edit.5', $jobPoster); |
|
728 | + return redirect ()->route ('job.application.edit.5', $jobPoster); |
|
729 | 729 | break; |
730 | 730 | case 'previous': |
731 | - return redirect()->route('job.application.edit.3', $jobPoster); |
|
731 | + return redirect ()->route ('job.application.edit.3', $jobPoster); |
|
732 | 732 | break; |
733 | 733 | default: |
734 | - return redirect()->back()->withInput(); |
|
734 | + return redirect ()->back ()->withInput (); |
|
735 | 735 | } |
736 | 736 | } |
737 | 737 | |
@@ -742,17 +742,17 @@ discard block |
||
742 | 742 | * @param \App\Models\JobPoster $jobPoster Incoming Job Poster object. |
743 | 743 | * @return \Illuminate\Http\Response |
744 | 744 | */ |
745 | - public function submit(Request $request, JobPoster $jobPoster) |
|
745 | + public function submit (Request $request, JobPoster $jobPoster) |
|
746 | 746 | { |
747 | - $applicant = Auth::user()->applicant; |
|
748 | - $application = $this->getApplicationFromJob($jobPoster); |
|
747 | + $applicant = Auth::user ()->applicant; |
|
748 | + $application = $this->getApplicationFromJob ($jobPoster); |
|
749 | 749 | |
750 | 750 | // Ensure user has permissions to update this application. |
751 | - $this->authorize('update', $application); |
|
751 | + $this->authorize ('update', $application); |
|
752 | 752 | |
753 | 753 | // Only complete submission if submit button was pressed. |
754 | - if ($request->input('submit') == 'submit') { |
|
755 | - $request->validate([ |
|
754 | + if ($request->input ('submit') == 'submit') { |
|
755 | + $request->validate ([ |
|
756 | 756 | 'submission_signature' => [ |
757 | 757 | 'required', |
758 | 758 | 'string', |
@@ -766,35 +766,35 @@ discard block |
||
766 | 766 | ]); |
767 | 767 | |
768 | 768 | // Save any final info. |
769 | - $application->fill([ |
|
770 | - 'submission_signature' => $request->input('submission_signature'), |
|
771 | - 'submission_date' => $request->input('submission_date'), |
|
769 | + $application->fill ([ |
|
770 | + 'submission_signature' => $request->input ('submission_signature'), |
|
771 | + 'submission_date' => $request->input ('submission_date'), |
|
772 | 772 | ]); |
773 | 773 | |
774 | 774 | // Error out of this process now if application is not complete. |
775 | - $validator = new ApplicationValidator(); |
|
776 | - $validator->validate($application); |
|
775 | + $validator = new ApplicationValidator (); |
|
776 | + $validator->validate ($application); |
|
777 | 777 | |
778 | 778 | // Change status to 'submitted'. |
779 | - $application->application_status_id = ApplicationStatus::where('name', 'submitted')->firstOrFail()->id; |
|
780 | - $application->saveProfileSnapshot(); |
|
779 | + $application->application_status_id = ApplicationStatus::where ('name', 'submitted')->firstOrFail ()->id; |
|
780 | + $application->saveProfileSnapshot (); |
|
781 | 781 | } |
782 | 782 | |
783 | - $application->save(); |
|
783 | + $application->save (); |
|
784 | 784 | |
785 | 785 | // Redirect to correct page. |
786 | - switch ($request->input('submit')) { |
|
786 | + switch ($request->input ('submit')) { |
|
787 | 787 | case 'save_and_quit': |
788 | - return redirect()->route('applications.index'); |
|
788 | + return redirect ()->route ('applications.index'); |
|
789 | 789 | break; |
790 | 790 | case 'submit': |
791 | - return redirect()->route('job.application.complete', $jobPoster); |
|
791 | + return redirect ()->route ('job.application.complete', $jobPoster); |
|
792 | 792 | break; |
793 | 793 | case 'previous': |
794 | - return redirect()->route('job.application.edit.4', $jobPoster); |
|
794 | + return redirect ()->route ('job.application.edit.4', $jobPoster); |
|
795 | 795 | break; |
796 | 796 | default: |
797 | - return redirect()->back()->withInput(); |
|
797 | + return redirect ()->back ()->withInput (); |
|
798 | 798 | } |
799 | 799 | } |
800 | 800 | } |