@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * @property \Illuminate\Database\Eloquent\Collection $skill_declarations |
26 | 26 | * @property \App\Models\Applicant $applicant |
27 | 27 | */ |
28 | -class WorkSample extends BaseModel { |
|
28 | +class WorkSample extends BaseModel{ |
|
29 | 29 | |
30 | 30 | protected $casts = [ |
31 | 31 | 'name' => 'string', |
@@ -43,20 +43,20 @@ discard block |
||
43 | 43 | 'description' |
44 | 44 | ]; |
45 | 45 | |
46 | - public function file_type() { |
|
47 | - return $this->belongsTo(\App\Models\Lookup\FileType::class); |
|
46 | + public function file_type(){ |
|
47 | + return $this->belongsTo (\App\Models\Lookup\FileType::class); |
|
48 | 48 | } |
49 | 49 | |
50 | - public function application_work_samples() { |
|
51 | - return $this->hasMany(\App\Models\ApplicationWorkSample::class); |
|
50 | + public function application_work_samples(){ |
|
51 | + return $this->hasMany (\App\Models\ApplicationWorkSample::class); |
|
52 | 52 | } |
53 | 53 | |
54 | - public function skill_declarations() { |
|
55 | - return $this->belongsToMany(\App\Models\SkillDeclaration::class); |
|
54 | + public function skill_declarations(){ |
|
55 | + return $this->belongsToMany (\App\Models\SkillDeclaration::class); |
|
56 | 56 | } |
57 | 57 | |
58 | - public function applicant() { |
|
59 | - return $this->belongsTo(\App\Models\Applicant::class); |
|
58 | + public function applicant(){ |
|
59 | + return $this->belongsTo (\App\Models\Applicant::class); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | } |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public function compose(View $view) |
20 | 20 | { |
21 | - if (WhichPortal::isApplicantPortal()) { |
|
22 | - $menu = Lang::get('applicant/menu'); |
|
21 | + if (WhichPortal::isApplicantPortal ()) { |
|
22 | + $menu = Lang::get ('applicant/menu'); |
|
23 | 23 | |
24 | 24 | // Set active on the proper item |
25 | - switch (Route::currentRouteName()) { |
|
25 | + switch (Route::currentRouteName ()) { |
|
26 | 26 | case 'home': |
27 | 27 | $menu['items']['home']['active'] = true; |
28 | 28 | break; |
@@ -82,15 +82,15 @@ discard block |
||
82 | 82 | } |
83 | 83 | |
84 | 84 | // Set route links |
85 | - $menu['items']['home']['link'] = route('home'); |
|
86 | - $menu['items']['jobs']['link'] = route('jobs.index'); |
|
87 | - $menu['items']['applications']['link'] = route('applications.index'); |
|
88 | - $menu['items']['profile']['link'] = route('profile'); |
|
89 | - $menu['items']['faq']['link'] = route('faq'); |
|
90 | - $menu['items']['itp']['link'] = route('itp'); |
|
85 | + $menu['items']['home']['link'] = route ('home'); |
|
86 | + $menu['items']['jobs']['link'] = route ('jobs.index'); |
|
87 | + $menu['items']['applications']['link'] = route ('applications.index'); |
|
88 | + $menu['items']['profile']['link'] = route ('profile'); |
|
89 | + $menu['items']['faq']['link'] = route ('faq'); |
|
90 | + $menu['items']['itp']['link'] = route ('itp'); |
|
91 | 91 | |
92 | 92 | // Check if use is logged in, and remove invalid menu items |
93 | - if (Auth::check()) { |
|
93 | + if (Auth::check ()) { |
|
94 | 94 | unset($menu['items']['login']); |
95 | 95 | unset($menu['items']['register']); |
96 | 96 | // TODO set profile like using user slug |
@@ -99,11 +99,11 @@ discard block |
||
99 | 99 | unset($menu['items']['applications']); |
100 | 100 | unset($menu['items']['profile']); |
101 | 101 | } |
102 | - } elseif (WhichPortal::isManagerPortal()) { |
|
103 | - $menu = Lang::get('manager/menu'); |
|
102 | + } elseif (WhichPortal::isManagerPortal ()) { |
|
103 | + $menu = Lang::get ('manager/menu'); |
|
104 | 104 | |
105 | 105 | // Set active on the proper item |
106 | - switch (Route::currentRouteName()) { |
|
106 | + switch (Route::currentRouteName ()) { |
|
107 | 107 | case 'manager.home': |
108 | 108 | $menu['items']['home']['active'] = true; |
109 | 109 | break; |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | // Set route links |
147 | - $menu['items']['home']['link'] = route('manager.home'); |
|
148 | - $menu['items']['jobs']['link'] = route('manager.jobs.index'); |
|
147 | + $menu['items']['home']['link'] = route ('manager.home'); |
|
148 | + $menu['items']['jobs']['link'] = route ('manager.jobs.index'); |
|
149 | 149 | // TODO: restore when job poster builder complete |
150 | 150 | // $menu['items']['create_job']['link'] = route('manager.jobs.create'); |
151 | - $menu['items']['profile']['link'] = route('manager.profile'); |
|
152 | - $menu['items']['faq']['link'] = route('manager.faq.section'); |
|
151 | + $menu['items']['profile']['link'] = route ('manager.profile'); |
|
152 | + $menu['items']['faq']['link'] = route ('manager.faq.section'); |
|
153 | 153 | |
154 | 154 | // Check if use is logged in, and remove invalid menu items |
155 | - if (Auth::check()) { |
|
155 | + if (Auth::check ()) { |
|
156 | 156 | unset($menu['items']['login']); |
157 | 157 | unset($menu['items']['register']); |
158 | 158 | // TODO set profile like using user slug |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | unset($menu['items']['create_job']); |
163 | 163 | unset($menu['items']['profile']); |
164 | 164 | } |
165 | - } elseif (WhichPortal::isHrPortal()) { |
|
166 | - $menu = Lang::get('hr_advisor/menu'); |
|
165 | + } elseif (WhichPortal::isHrPortal ()) { |
|
166 | + $menu = Lang::get ('hr_advisor/menu'); |
|
167 | 167 | |
168 | 168 | // Set active on the proper item |
169 | - switch (Route::currentRouteName()) { |
|
169 | + switch (Route::currentRouteName ()) { |
|
170 | 170 | case 'hr_advisor.home': |
171 | 171 | $menu['items']['home']['active'] = true; |
172 | 172 | break; |
@@ -185,23 +185,23 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | // Set route links |
188 | - $menu['items']['home']['link'] = route('hr_advisor.home'); |
|
188 | + $menu['items']['home']['link'] = route ('hr_advisor.home'); |
|
189 | 189 | |
190 | 190 | // Check if use is logged in, and remove invalid menu items |
191 | - if (Auth::check()) { |
|
191 | + if (Auth::check ()) { |
|
192 | 192 | unset($menu['items']['login']); |
193 | 193 | unset($menu['items']['register']); |
194 | 194 | // TODO set profile like using user slug |
195 | 195 | } else { |
196 | 196 | unset($menu['items']['logout']); |
197 | 197 | } |
198 | - } elseif (WhichPortal::isAdminPortal()) { |
|
198 | + } elseif (WhichPortal::isAdminPortal ()) { |
|
199 | 199 | // Use the manager menu, keeping only |
200 | - $menu = Lang::get('admin/menu'); |
|
200 | + $menu = Lang::get ('admin/menu'); |
|
201 | 201 | |
202 | 202 | |
203 | 203 | // Set active on the proper item |
204 | - switch (Route::currentRouteName()) { |
|
204 | + switch (Route::currentRouteName ()) { |
|
205 | 205 | case 'admin.home': |
206 | 206 | $menu['items']['home']['active'] = true; |
207 | 207 | break; |
@@ -211,10 +211,10 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // Set route links |
214 | - $menu['items']['home']['link'] = backpack_url(); |
|
214 | + $menu['items']['home']['link'] = backpack_url (); |
|
215 | 215 | |
216 | 216 | // Check if use is logged in, and remove invalid menu items |
217 | - if (Auth::check()) { |
|
217 | + if (Auth::check ()) { |
|
218 | 218 | unset($menu['items']['login']); |
219 | 219 | unset($menu['items']['register']); |
220 | 220 | // TODO set profile like using user slug |
@@ -223,37 +223,37 @@ discard block |
||
223 | 223 | } |
224 | 224 | } |
225 | 225 | // Set login modals data |
226 | - if (WhichPortal::isManagerPortal()) { |
|
226 | + if (WhichPortal::isManagerPortal ()) { |
|
227 | 227 | $loginModals = [ |
228 | - 'modals' => Lang::get('common/login_modals'), |
|
229 | - 'register_link' => route('manager.register'), |
|
230 | - 'login_link' => route('manager.login'), |
|
231 | - 'logout_link' => route('manager.logout'), |
|
228 | + 'modals' => Lang::get ('common/login_modals'), |
|
229 | + 'register_link' => route ('manager.register'), |
|
230 | + 'login_link' => route ('manager.login'), |
|
231 | + 'logout_link' => route ('manager.logout'), |
|
232 | 232 | ]; |
233 | - } elseif (WhichPortal::isHrPortal()) { |
|
233 | + } elseif (WhichPortal::isHrPortal ()) { |
|
234 | 234 | $loginModals = [ |
235 | - 'modals' => Lang::get('common/login_modals'), |
|
236 | - 'register_link' => route('hr_advisor.register'), |
|
237 | - 'login_link' => route('hr_advisor.login'), |
|
238 | - 'logout_link' => route('hr_advisor.logout'), |
|
235 | + 'modals' => Lang::get ('common/login_modals'), |
|
236 | + 'register_link' => route ('hr_advisor.register'), |
|
237 | + 'login_link' => route ('hr_advisor.login'), |
|
238 | + 'logout_link' => route ('hr_advisor.logout'), |
|
239 | 239 | ]; |
240 | - } elseif (WhichPortal::isAdminPortal()) { |
|
240 | + } elseif (WhichPortal::isAdminPortal ()) { |
|
241 | 241 | $loginModals = [ |
242 | - 'modals' => Lang::get('common/login_modals'), |
|
243 | - 'register_link' => route('register'), |
|
244 | - 'login_link' => backpack_url('login'), |
|
245 | - 'logout_link' => backpack_url('logout'), |
|
242 | + 'modals' => Lang::get ('common/login_modals'), |
|
243 | + 'register_link' => route ('register'), |
|
244 | + 'login_link' => backpack_url ('login'), |
|
245 | + 'logout_link' => backpack_url ('logout'), |
|
246 | 246 | ]; |
247 | 247 | } else { |
248 | 248 | $loginModals = [ |
249 | - 'modals' => Lang::get('common/login_modals'), |
|
250 | - 'register_link' => route('register'), |
|
251 | - 'login_link' => route('login'), |
|
252 | - 'logout_link' => route('logout'), |
|
249 | + 'modals' => Lang::get ('common/login_modals'), |
|
250 | + 'register_link' => route ('register'), |
|
251 | + 'login_link' => route ('login'), |
|
252 | + 'logout_link' => route ('logout'), |
|
253 | 253 | ]; |
254 | 254 | } |
255 | 255 | |
256 | - $view->with('menu', $menu) |
|
257 | - ->with('login_modals', $loginModals); |
|
256 | + $view->with ('menu', $menu) |
|
257 | + ->with ('login_modals', $loginModals); |
|
258 | 258 | } |
259 | 259 | } |
@@ -22,39 +22,39 @@ |
||
22 | 22 | */ |
23 | 23 | public function getForJob(JobPoster $jobPoster) |
24 | 24 | { |
25 | - if (Gate::denies('view-assessment-plan', $jobPoster)) { |
|
26 | - abort(403); |
|
25 | + if (Gate::denies ('view-assessment-plan', $jobPoster)) { |
|
26 | + abort (403); |
|
27 | 27 | } |
28 | 28 | |
29 | - $criteria = Criteria::where('job_poster_id', $jobPoster->id)->get(); |
|
29 | + $criteria = Criteria::where ('job_poster_id', $jobPoster->id)->get (); |
|
30 | 30 | $criteriaTranslated = []; |
31 | 31 | foreach ($criteria as $criterion) { |
32 | 32 | // TODO: getTranslationsArray probably makes DB calls every loop. Find a way to profile & optimize. |
33 | - $criteriaTranslated[] = array_merge($criterion->toArray(), $criterion->getTranslationsArray()); |
|
33 | + $criteriaTranslated[] = array_merge ($criterion->toArray (), $criterion->getTranslationsArray ()); |
|
34 | 34 | } |
35 | - $criteriaIds = $criteria->pluck('id'); |
|
36 | - $assessments = Assessment::whereIn('criterion_id', $criteriaIds)->get(); |
|
35 | + $criteriaIds = $criteria->pluck ('id'); |
|
36 | + $assessments = Assessment::whereIn ('criterion_id', $criteriaIds)->get (); |
|
37 | 37 | // Check for newly created assessment plan, and initialize any empty criteria to have the |
38 | 38 | // "Narrative Review" option set. |
39 | - $assessmentCriteriaIds = $assessments->pluck('criterion_id'); |
|
40 | - $emptyAssessments = array_diff($criteriaIds->toArray(), $assessmentCriteriaIds->toArray()); |
|
39 | + $assessmentCriteriaIds = $assessments->pluck ('criterion_id'); |
|
40 | + $emptyAssessments = array_diff ($criteriaIds->toArray (), $assessmentCriteriaIds->toArray ()); |
|
41 | 41 | if (!empty($emptyAssessments)) { |
42 | - $narrativeReview = AssessmentType::where('key', 'narrative_assessment')->first(); |
|
42 | + $narrativeReview = AssessmentType::where ('key', 'narrative_assessment')->first (); |
|
43 | 43 | foreach ($emptyAssessments as $criterionId) { |
44 | - Assessment::create([ |
|
44 | + Assessment::create ([ |
|
45 | 45 | 'criterion_id' => $criterionId, |
46 | 46 | 'assessment_type_id' => $narrativeReview->id |
47 | 47 | ]); |
48 | 48 | } |
49 | - $assessments = Assessment::whereIn('criterion_id', $criteriaIds)->get(); |
|
49 | + $assessments = Assessment::whereIn ('criterion_id', $criteriaIds)->get (); |
|
50 | 50 | } |
51 | - $questions = RatingGuideQuestion::where('job_poster_id', $jobPoster->id)->get(); |
|
52 | - $answers = RatingGuideAnswer::whereIn('rating_guide_question_id', $questions->pluck('id'))->get(); |
|
51 | + $questions = RatingGuideQuestion::where ('job_poster_id', $jobPoster->id)->get (); |
|
52 | + $answers = RatingGuideAnswer::whereIn ('rating_guide_question_id', $questions->pluck ('id'))->get (); |
|
53 | 53 | return [ |
54 | 54 | 'criteria' => $criteriaTranslated, |
55 | - 'assessments' => $assessments->toArray(), |
|
56 | - 'rating_guide_questions' => $questions->toArray(), |
|
57 | - 'rating_guide_answers' => $answers->toArray() |
|
55 | + 'assessments' => $assessments->toArray (), |
|
56 | + 'rating_guide_questions' => $questions->toArray (), |
|
57 | + 'rating_guide_answers' => $answers->toArray () |
|
58 | 58 | ]; |
59 | 59 | } |
60 | 60 | } |
@@ -19,60 +19,60 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function setup() : void |
21 | 21 | { |
22 | - $this->crud->setModel('App\Models\JobPoster'); |
|
23 | - $this->crud->setRoute('admin/job-poster'); |
|
24 | - $this->crud->setEntityNameStrings('Job Poster', 'Job Posters'); |
|
22 | + $this->crud->setModel ('App\Models\JobPoster'); |
|
23 | + $this->crud->setRoute ('admin/job-poster'); |
|
24 | + $this->crud->setEntityNameStrings ('Job Poster', 'Job Posters'); |
|
25 | 25 | |
26 | - if (!$this->request->has('order')) { |
|
27 | - $this->crud->orderBy('close_date_time', 'desc'); |
|
26 | + if (!$this->request->has ('order')) { |
|
27 | + $this->crud->orderBy ('close_date_time', 'desc'); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | |
31 | 31 | public function setupListOperation() |
32 | 32 | { |
33 | 33 | // Add the custom blade buttons found in resources/views/vendor/backpack/crud/buttons/. |
34 | - $this->crud->addButtonFromView('line', 'job_admin_edit', 'job_admin_edit', 'end'); |
|
35 | - $this->crud->addButtonFromView('line', 'spb_link', 'spb_link', 'end'); |
|
36 | - $this->crud->addButtonFromView('line', 'jpb_link', 'jpb_link', 'end'); |
|
37 | - $this->crud->addButtonFromView('line', 'job_poster_link', 'job_poster_link', 'end'); |
|
34 | + $this->crud->addButtonFromView ('line', 'job_admin_edit', 'job_admin_edit', 'end'); |
|
35 | + $this->crud->addButtonFromView ('line', 'spb_link', 'spb_link', 'end'); |
|
36 | + $this->crud->addButtonFromView ('line', 'jpb_link', 'jpb_link', 'end'); |
|
37 | + $this->crud->addButtonFromView ('line', 'job_poster_link', 'job_poster_link', 'end'); |
|
38 | 38 | |
39 | 39 | |
40 | - $this->crud->addColumn([ |
|
40 | + $this->crud->addColumn ([ |
|
41 | 41 | 'name' => 'id', |
42 | 42 | 'type' => 'number', |
43 | 43 | 'label' => 'ID' |
44 | 44 | ]); |
45 | - $this->crud->addColumn([ |
|
45 | + $this->crud->addColumn ([ |
|
46 | 46 | 'name' => 'title', |
47 | 47 | 'type' => 'text', |
48 | 48 | 'label' => 'Title' |
49 | 49 | ]); |
50 | - $this->crud->addColumn([ |
|
50 | + $this->crud->addColumn ([ |
|
51 | 51 | 'name' => 'status', |
52 | 52 | 'label' => 'Status', |
53 | 53 | 'type' => 'model_function', |
54 | 54 | 'function_name' => 'status' |
55 | 55 | ]); |
56 | - $this->crud->addColumn([ |
|
56 | + $this->crud->addColumn ([ |
|
57 | 57 | 'name' => 'published', |
58 | 58 | 'label' => 'Published', |
59 | 59 | 'type' => 'check', |
60 | 60 | ]); |
61 | - $this->crud->addColumn([ |
|
61 | + $this->crud->addColumn ([ |
|
62 | 62 | 'name' => 'manager_user_name', |
63 | 63 | 'type' => 'closure', |
64 | 64 | 'label' => 'Manager', |
65 | 65 | 'orderable' => false, |
66 | - 'function' => function ($entry) { |
|
67 | - return '<a href="' . route('manager.profile.edit', $entry->manager->user->id) . '" target="_blank">' . $entry->manager->user->full_name . '</a>'; |
|
66 | + 'function' => function ($entry){ |
|
67 | + return '<a href="'.route ('manager.profile.edit', $entry->manager->user->id).'" target="_blank">'.$entry->manager->user->full_name.'</a>'; |
|
68 | 68 | } |
69 | 69 | ]); |
70 | - $this->crud->addColumn([ |
|
70 | + $this->crud->addColumn ([ |
|
71 | 71 | 'name' => 'department.name', |
72 | 72 | 'label' => 'Department', |
73 | 73 | 'type' => 'text' |
74 | 74 | ]); |
75 | - $this->crud->addColumn([ |
|
75 | + $this->crud->addColumn ([ |
|
76 | 76 | 'name' => 'submitted_applications_count', |
77 | 77 | 'label' => 'Total Applications', |
78 | 78 | 'type' => 'model_function', |
@@ -80,19 +80,19 @@ discard block |
||
80 | 80 | ]); |
81 | 81 | |
82 | 82 | // Filters. |
83 | - $this->crud->addFilter([ |
|
83 | + $this->crud->addFilter ([ |
|
84 | 84 | 'name' => 'departments', |
85 | 85 | 'type' => 'select2_multiple', |
86 | 86 | 'label' => 'Departments' |
87 | - ], function () { |
|
88 | - return Department::all()->pluck('name', 'id')->toArray(); |
|
89 | - }, function ($values) { |
|
90 | - $this->crud->addClause('WhereHas', 'department', function ($query) use ($values) { |
|
91 | - foreach (json_decode($values) as $key => $value) { |
|
87 | + ], function (){ |
|
88 | + return Department::all ()->pluck ('name', 'id')->toArray (); |
|
89 | + }, function ($values){ |
|
90 | + $this->crud->addClause ('WhereHas', 'department', function ($query) use ($values) { |
|
91 | + foreach (json_decode ($values) as $key => $value) { |
|
92 | 92 | if ($key === 0) { |
93 | - $query->where('id', $value); |
|
93 | + $query->where ('id', $value); |
|
94 | 94 | } else { |
95 | - $query->orWhere('id', $value); |
|
95 | + $query->orWhere ('id', $value); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | }); |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function setupUpdateOperation() |
103 | 103 | { |
104 | - $this->crud->addField([ |
|
104 | + $this->crud->addField ([ |
|
105 | 105 | 'name' => 'title', |
106 | 106 | 'label' => 'Title', |
107 | 107 | 'type' => 'text', |
@@ -109,22 +109,22 @@ discard block |
||
109 | 109 | 'readonly' => 'readonly' |
110 | 110 | ] |
111 | 111 | ]); |
112 | - $this->crud->addField([ |
|
112 | + $this->crud->addField ([ |
|
113 | 113 | 'name' => 'salary_min', |
114 | 114 | 'type' => 'number', |
115 | 115 | 'label' => 'Minimum Salary', |
116 | 116 | ]); |
117 | - $this->crud->addField([ |
|
117 | + $this->crud->addField ([ |
|
118 | 118 | 'name' => 'salary_max', |
119 | 119 | 'type' => 'number', |
120 | 120 | 'label' => 'Maximum Salary', |
121 | 121 | ]); |
122 | - $this->crud->addField([ |
|
122 | + $this->crud->addField ([ |
|
123 | 123 | 'name' => 'noc', |
124 | 124 | 'type' => 'number', |
125 | 125 | 'label' => 'NOC Code', |
126 | 126 | ]); |
127 | - $this->crud->addField([ |
|
127 | + $this->crud->addField ([ |
|
128 | 128 | 'name' => 'open_date_time', |
129 | 129 | 'label' => 'Open Date', |
130 | 130 | 'type' => 'date_picker', |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | 'format' => 'yyyy-mm-dd', |
134 | 134 | ], |
135 | 135 | ]); |
136 | - $this->crud->addField([ |
|
136 | + $this->crud->addField ([ |
|
137 | 137 | 'name' => 'close_date_time', |
138 | 138 | 'label' => 'Close Date', |
139 | 139 | 'type' => 'date_picker', |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | 'format' => 'yyyy-mm-dd', |
143 | 143 | ], |
144 | 144 | ]); |
145 | - $this->crud->addField([ |
|
145 | + $this->crud->addField ([ |
|
146 | 146 | 'name' => 'start_date_time', |
147 | 147 | 'label' => 'Start Date', |
148 | 148 | 'type' => 'date_picker', |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | 'format' => 'yyyy-mm-dd', |
152 | 152 | ], |
153 | 153 | ]); |
154 | - $this->crud->addField([ |
|
154 | + $this->crud->addField ([ |
|
155 | 155 | 'name' => 'process_number', |
156 | 156 | 'type' => 'number', |
157 | 157 | 'label' => 'Process #', |
158 | 158 | ]); |
159 | - $this->crud->addField([ |
|
159 | + $this->crud->addField ([ |
|
160 | 160 | 'name' => 'priority_clearance_number', |
161 | 161 | 'type' => 'number', |
162 | 162 | 'label' => 'Priority Clearance #', |
163 | 163 | ]); |
164 | - $this->crud->addField([ |
|
164 | + $this->crud->addField ([ |
|
165 | 165 | 'name' => 'loo_issuance_date', |
166 | 166 | 'type' => 'date_picker', |
167 | 167 | 'label' => 'Letter of Offer Issuance Date', |
@@ -170,10 +170,10 @@ discard block |
||
170 | 170 | 'format' => 'yyyy-mm-dd', |
171 | 171 | ], |
172 | 172 | ]); |
173 | - if ($this->crud->getCurrentEntry() && |
|
174 | - !$this->crud->getCurrentEntry()->published |
|
173 | + if ($this->crud->getCurrentEntry () && |
|
174 | + !$this->crud->getCurrentEntry ()->published |
|
175 | 175 | ) { |
176 | - $this->crud->addField([ |
|
176 | + $this->crud->addField ([ |
|
177 | 177 | 'name' => 'published', |
178 | 178 | 'label' => 'Publish', |
179 | 179 | 'type' => 'checkbox' |
@@ -183,20 +183,20 @@ discard block |
||
183 | 183 | |
184 | 184 | public function update() |
185 | 185 | { |
186 | - $open_date = $this->crud->request->request->get('open_date_time'); |
|
187 | - $close_date = $this->crud->request->request->get('close_date_time'); |
|
188 | - $start_date = $this->crud->request->request->get('start_date_time'); |
|
189 | - $this->crud->request->request->remove('open_date_time'); |
|
190 | - $this->crud->request->request->remove('close_date_time'); |
|
191 | - $this->crud->request->request->remove('start_date_time'); |
|
186 | + $open_date = $this->crud->request->request->get ('open_date_time'); |
|
187 | + $close_date = $this->crud->request->request->get ('close_date_time'); |
|
188 | + $start_date = $this->crud->request->request->get ('start_date_time'); |
|
189 | + $this->crud->request->request->remove ('open_date_time'); |
|
190 | + $this->crud->request->request->remove ('close_date_time'); |
|
191 | + $this->crud->request->request->remove ('start_date_time'); |
|
192 | 192 | // Manipulates the input fields to save the "end of day" timestamp for |
193 | 193 | // open/close/start dates. |
194 | - $this->crud->request->request->add([ |
|
195 | - 'open_date_time' => ptDayStartToUtcTime($open_date), |
|
196 | - 'close_date_time' => ptDayEndToUtcTime($close_date), |
|
197 | - 'start_date_time' => ptDayStartToUtcTime($start_date), |
|
194 | + $this->crud->request->request->add ([ |
|
195 | + 'open_date_time' => ptDayStartToUtcTime ($open_date), |
|
196 | + 'close_date_time' => ptDayEndToUtcTime ($close_date), |
|
197 | + 'start_date_time' => ptDayStartToUtcTime ($start_date), |
|
198 | 198 | ]); |
199 | - $response = $this->traitUpdate(); |
|
199 | + $response = $this->traitUpdate (); |
|
200 | 200 | |
201 | 201 | return $response; |
202 | 202 | } |
@@ -17,49 +17,49 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function setup() : void |
19 | 19 | { |
20 | - $this->crud->setModel('App\Models\User'); |
|
21 | - $this->crud->setRoute('admin/manager'); |
|
22 | - $this->crud->setEntityNameStrings('manager', 'managers'); |
|
20 | + $this->crud->setModel ('App\Models\User'); |
|
21 | + $this->crud->setRoute ('admin/manager'); |
|
22 | + $this->crud->setEntityNameStrings ('manager', 'managers'); |
|
23 | 23 | |
24 | 24 | // Don't show 'basic' users. |
25 | - $this->crud->addClause('whereIn', 'user_role_id', [2, 3]); |
|
25 | + $this->crud->addClause ('whereIn', 'user_role_id', [2, 3]); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function setupListOperation() |
29 | 29 | { |
30 | - $this->crud->removeButton('update'); |
|
30 | + $this->crud->removeButton ('update'); |
|
31 | 31 | |
32 | - $this->crud->addColumn([ |
|
32 | + $this->crud->addColumn ([ |
|
33 | 33 | 'name' => 'manager.id', |
34 | 34 | 'key' => 'manager_id', |
35 | 35 | 'type' => 'number', |
36 | 36 | 'label' => 'ID' |
37 | 37 | ]); |
38 | - $this->crud->addColumn([ |
|
38 | + $this->crud->addColumn ([ |
|
39 | 39 | 'name' => 'manager.name', |
40 | 40 | 'key' => 'manager_name', |
41 | 41 | 'type' => 'text', |
42 | 42 | 'label' => 'Name' |
43 | 43 | ]); |
44 | - $this->crud->addColumn([ |
|
44 | + $this->crud->addColumn ([ |
|
45 | 45 | 'name' => 'user_role.name', |
46 | 46 | 'type' => 'text', |
47 | 47 | 'key' => 'user_role_name', |
48 | 48 | 'label' => 'Role' |
49 | 49 | ]); |
50 | - $this->crud->addColumn([ |
|
50 | + $this->crud->addColumn ([ |
|
51 | 51 | 'name' => 'email', |
52 | 52 | 'key' => 'manager_email', |
53 | 53 | 'type' => 'text', |
54 | 54 | 'label' => 'Email' |
55 | 55 | ]); |
56 | - $this->crud->addColumn([ |
|
56 | + $this->crud->addColumn ([ |
|
57 | 57 | 'name' => 'gov_email', |
58 | 58 | 'key' => 'government_email', |
59 | 59 | 'type' => 'text', |
60 | 60 | 'label' => 'Government Email' |
61 | 61 | ]); |
62 | - $this->crud->addColumn([ |
|
62 | + $this->crud->addColumn ([ |
|
63 | 63 | 'name' => 'manager.department.name', |
64 | 64 | 'key' => 'manager_department', |
65 | 65 | 'type' => 'text', |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | ]); |
69 | 69 | |
70 | 70 | // Add the custom blade button found in resources/views/vendor/backpack/crud/buttons/profile_edit.blade.php. |
71 | - $this->crud->addButtonFromView('line', 'create_job_poster', 'create_job_poster', 'beginning'); |
|
72 | - $this->crud->addButtonFromView('line', 'profile_edit', 'profile_edit', 'end'); |
|
71 | + $this->crud->addButtonFromView ('line', 'create_job_poster', 'create_job_poster', 'beginning'); |
|
72 | + $this->crud->addButtonFromView ('line', 'profile_edit', 'profile_edit', 'end'); |
|
73 | 73 | } |
74 | 74 | } |
@@ -15,27 +15,27 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public function applicant() |
17 | 17 | { |
18 | - $now = Carbon::now(); |
|
18 | + $now = Carbon::now (); |
|
19 | 19 | |
20 | 20 | // Find three most recent published jobs that are currently open for applications. |
21 | 21 | // Eager load required relationships: Department, Province, JobTerm. |
22 | - $jobs = JobPoster::where('open_date_time', '<=', $now) |
|
23 | - ->where('close_date_time', '>=', $now) |
|
24 | - ->where('published', true) |
|
25 | - ->with([ |
|
22 | + $jobs = JobPoster::where ('open_date_time', '<=', $now) |
|
23 | + ->where ('close_date_time', '>=', $now) |
|
24 | + ->where ('published', true) |
|
25 | + ->with ([ |
|
26 | 26 | 'department', |
27 | 27 | 'province', |
28 | 28 | ]) |
29 | - ->orderBy('open_date_time', 'desc') |
|
30 | - ->take(3) |
|
31 | - ->get(); |
|
32 | - return view('applicant/home', [ |
|
33 | - 'home' => Lang::get('applicant/home'), |
|
34 | - 'hero' => Lang::get('common/hero'), |
|
35 | - 'job_index' => Lang::get('applicant/job_index'), |
|
36 | - 'job_post' => Lang::get('applicant/job_post'), |
|
29 | + ->orderBy ('open_date_time', 'desc') |
|
30 | + ->take (3) |
|
31 | + ->get (); |
|
32 | + return view ('applicant/home', [ |
|
33 | + 'home' => Lang::get ('applicant/home'), |
|
34 | + 'hero' => Lang::get ('common/hero'), |
|
35 | + 'job_index' => Lang::get ('applicant/job_index'), |
|
36 | + 'job_post' => Lang::get ('applicant/job_post'), |
|
37 | 37 | 'jobs' => $jobs, |
38 | - 'job_count' => count($jobs) |
|
38 | + 'job_count' => count ($jobs) |
|
39 | 39 | ]); |
40 | 40 | } |
41 | 41 | |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | */ |
46 | 46 | public function manager() |
47 | 47 | { |
48 | - return view('manager/home', [ |
|
49 | - 'home_l10n' => Lang::get('manager/home'), |
|
48 | + return view ('manager/home', [ |
|
49 | + 'home_l10n' => Lang::get ('manager/home'), |
|
50 | 50 | ]); |
51 | 51 | } |
52 | 52 | |
@@ -56,8 +56,8 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function hr_advisor() //phpcs:ignore |
58 | 58 | { |
59 | - return view('hr_advisor/home', [ |
|
60 | - 'hr_home' => Lang::get('hr_advisor/home'), |
|
59 | + return view ('hr_advisor/home', [ |
|
60 | + 'hr_home' => Lang::get ('hr_advisor/home'), |
|
61 | 61 | ]); |
62 | 62 | } |
63 | 63 | } |
@@ -14,36 +14,36 @@ |
||
14 | 14 | */ |
15 | 15 | protected function auth_routes() //phpcs:ignore |
16 | 16 | { |
17 | - if (WhichPortal::isManagerPortal()) { |
|
17 | + if (WhichPortal::isManagerPortal ()) { |
|
18 | 18 | $routes = [ |
19 | - 'home' => route('manager.home'), |
|
20 | - 'login' => route('manager.login'), |
|
21 | - 'register' => route('manager.register'), |
|
19 | + 'home' => route ('manager.home'), |
|
20 | + 'login' => route ('manager.login'), |
|
21 | + 'register' => route ('manager.register'), |
|
22 | 22 | 'password' => [ |
23 | - 'email' => route('manager.password.email'), |
|
24 | - 'request' => route('manager.password.request'), |
|
23 | + 'email' => route ('manager.password.email'), |
|
24 | + 'request' => route ('manager.password.request'), |
|
25 | 25 | ], |
26 | 26 | // 'passwords.reset' => route('manager.password.reset'), |
27 | 27 | ]; |
28 | - } elseif (WhichPortal::isHrPortal()) { |
|
28 | + } elseif (WhichPortal::isHrPortal ()) { |
|
29 | 29 | $routes = [ |
30 | - 'home' => route('hr_advisor.home'), |
|
31 | - 'login' => route('hr_advisor.login'), |
|
32 | - 'register' => route('hr_advisor.register'), |
|
30 | + 'home' => route ('hr_advisor.home'), |
|
31 | + 'login' => route ('hr_advisor.login'), |
|
32 | + 'register' => route ('hr_advisor.register'), |
|
33 | 33 | 'password' => [ |
34 | - 'email' => route('hr_advisor.password.email'), |
|
35 | - 'request' => route('hr_advisor.password.request'), |
|
34 | + 'email' => route ('hr_advisor.password.email'), |
|
35 | + 'request' => route ('hr_advisor.password.request'), |
|
36 | 36 | ], |
37 | 37 | // 'passwords.reset' => route('hr_advisor.password.reset'), |
38 | 38 | ]; |
39 | 39 | } else { |
40 | 40 | $routes = [ |
41 | - 'home' => route('home'), |
|
42 | - 'login' => route('login'), |
|
43 | - 'register' => route('register'), |
|
41 | + 'home' => route ('home'), |
|
42 | + 'login' => route ('login'), |
|
43 | + 'register' => route ('register'), |
|
44 | 44 | 'password' => [ |
45 | - 'email' => route('password.email'), |
|
46 | - 'request' => route('password.request'), |
|
45 | + 'email' => route ('password.email'), |
|
46 | + 'request' => route ('password.request'), |
|
47 | 47 | ], |
48 | 48 | // 'passwords.reset' => route('password.reset'), |
49 | 49 | ]; |
@@ -21,15 +21,15 @@ discard block |
||
21 | 21 | public function showFirstVisitManagerForm() |
22 | 22 | { |
23 | 23 | $routes = [ |
24 | - 'return' => route('home'), |
|
25 | - 'continue' => route('manager.finish_registration'), |
|
24 | + 'return' => route ('home'), |
|
25 | + 'continue' => route ('manager.finish_registration'), |
|
26 | 26 | ]; |
27 | 27 | |
28 | - return view('auth.first_visit_manager', [ |
|
28 | + return view ('auth.first_visit_manager', [ |
|
29 | 29 | 'routes' => $routes, |
30 | - 'first_visit' => Lang::get('common/auth/first_manager_visit'), |
|
31 | - 'departments' => Department::all(), |
|
32 | - 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')], |
|
30 | + 'first_visit' => Lang::get ('common/auth/first_manager_visit'), |
|
31 | + 'departments' => Department::all (), |
|
32 | + 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')], |
|
33 | 33 | ]); |
34 | 34 | } |
35 | 35 | |
@@ -41,35 +41,35 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function finishManagerRegistration(Request $request) |
43 | 43 | { |
44 | - $data = $request->all(); |
|
45 | - $validator = RegistrationValidator::finalizeManagerValidator($data); |
|
46 | - $validator->validate(); |
|
44 | + $data = $request->all (); |
|
45 | + $validator = RegistrationValidator::finalizeManagerValidator ($data); |
|
46 | + $validator->validate (); |
|
47 | 47 | |
48 | - $user = $request->user(); |
|
48 | + $user = $request->user (); |
|
49 | 49 | |
50 | 50 | // Save manager specific fields to user |
51 | - $managerDepartment = Department::find($data['department']); |
|
51 | + $managerDepartment = Department::find ($data['department']); |
|
52 | 52 | $inGovernment = ($managerDepartment !== null); |
53 | 53 | $user->not_in_gov = !$inGovernment; |
54 | 54 | $user->gov_email = $inGovernment ? $data['gov_email'] : null; |
55 | - $user->save(); |
|
56 | - $user->refresh(); |
|
55 | + $user->save (); |
|
56 | + $user->refresh (); |
|
57 | 57 | |
58 | 58 | // Add (or update) manager profile |
59 | 59 | // NOTE: modifying a field in $user, and saving it, appears to create Manager object. I don't know how. -- Tristan |
60 | 60 | // That means that after setting not_in_gov or gov_email, a manager already exists here. Adding a new one will throw an exception. |
61 | 61 | $department_id = $inGovernment ? $managerDepartment->id : null; |
62 | 62 | if ($user->manager === null) { |
63 | - $user->applicant()->save(new Manager()); |
|
64 | - $user->refresh(); |
|
63 | + $user->applicant ()->save (new Manager ()); |
|
64 | + $user->refresh (); |
|
65 | 65 | } |
66 | 66 | $user->manager->department_id = $department_id; |
67 | - $user->manager->save(); |
|
67 | + $user->manager->save (); |
|
68 | 68 | |
69 | - $user->refresh(); |
|
70 | - $expectedUrl = session()->remove('url.expected'); |
|
71 | - session()->remove('url.expected'); |
|
72 | - return redirect($expectedUrl); |
|
69 | + $user->refresh (); |
|
70 | + $expectedUrl = session ()->remove ('url.expected'); |
|
71 | + session ()->remove ('url.expected'); |
|
72 | + return redirect ($expectedUrl); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -80,15 +80,15 @@ discard block |
||
80 | 80 | public function showFirstVisitHrForm() |
81 | 81 | { |
82 | 82 | $routes = [ |
83 | - 'return' => route('hr_advisor.home'), |
|
84 | - 'continue' => route('hr_advisor.finish_registration'), |
|
83 | + 'return' => route ('hr_advisor.home'), |
|
84 | + 'continue' => route ('hr_advisor.finish_registration'), |
|
85 | 85 | ]; |
86 | 86 | |
87 | - return view('auth.first_visit_manager', [ |
|
87 | + return view ('auth.first_visit_manager', [ |
|
88 | 88 | 'routes' => $routes, |
89 | - 'first_visit' => Lang::get('common/auth/first_hr_visit'), |
|
90 | - 'departments' => Department::all(), |
|
91 | - 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')], |
|
89 | + 'first_visit' => Lang::get ('common/auth/first_hr_visit'), |
|
90 | + 'departments' => Department::all (), |
|
91 | + 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')], |
|
92 | 92 | ]); |
93 | 93 | } |
94 | 94 | |
@@ -100,31 +100,31 @@ discard block |
||
100 | 100 | */ |
101 | 101 | public function finishHrRegistration(Request $request) |
102 | 102 | { |
103 | - $data = $request->all(); |
|
104 | - $validator = RegistrationValidator::finalizeManagerValidator($data); |
|
105 | - $validator->validate(); |
|
103 | + $data = $request->all (); |
|
104 | + $validator = RegistrationValidator::finalizeManagerValidator ($data); |
|
105 | + $validator->validate (); |
|
106 | 106 | |
107 | - $user = $request->user(); |
|
107 | + $user = $request->user (); |
|
108 | 108 | |
109 | 109 | // Save manager specific fields to user |
110 | - $hrDepartment = Department::find($data['department']); |
|
110 | + $hrDepartment = Department::find ($data['department']); |
|
111 | 111 | $inGovernment = ($hrDepartment !== null); |
112 | 112 | $user->not_in_gov = !$inGovernment; |
113 | 113 | $user->gov_email = $inGovernment ? $data['gov_email'] : null; |
114 | 114 | |
115 | - $user->save(); |
|
116 | - $user->refresh(); |
|
115 | + $user->save (); |
|
116 | + $user->refresh (); |
|
117 | 117 | |
118 | 118 | $department_id = $inGovernment ? $hrDepartment->id : null; |
119 | 119 | if ($user->hr_advisor === null) { |
120 | - $user->hr_advisor()->save(new HrAdvisor()); |
|
121 | - $user->refresh(); |
|
120 | + $user->hr_advisor ()->save (new HrAdvisor ()); |
|
121 | + $user->refresh (); |
|
122 | 122 | } |
123 | 123 | $user->hr_advisor->department_id = $department_id; |
124 | 124 | $user->hr_advisor->user_id === $user->id; |
125 | - $user->hr_advisor->save(); |
|
125 | + $user->hr_advisor->save (); |
|
126 | 126 | |
127 | - $user->refresh(); |
|
128 | - return redirect(route('hr_advisor.home')); |
|
127 | + $user->refresh (); |
|
128 | + return redirect (route ('hr_advisor.home')); |
|
129 | 129 | } |
130 | 130 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | */ |
39 | 39 | protected function redirectTo() |
40 | 40 | { |
41 | - if (WhichPortal::isManagerPortal()) { |
|
42 | - $redirectTo = route('manager.home'); |
|
43 | - } elseif (WhichPortal::isHrPortal()) { |
|
44 | - $redirectTo = route('hr_advisor.home'); |
|
41 | + if (WhichPortal::isManagerPortal ()) { |
|
42 | + $redirectTo = route ('manager.home'); |
|
43 | + } elseif (WhichPortal::isHrPortal ()) { |
|
44 | + $redirectTo = route ('hr_advisor.home'); |
|
45 | 45 | } else { |
46 | - $redirectTo = route('home'); |
|
46 | + $redirectTo = route ('home'); |
|
47 | 47 | } |
48 | 48 | return $redirectTo; |
49 | 49 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function __construct() |
57 | 57 | { |
58 | - $this->middleware('guest'); |
|
58 | + $this->middleware ('guest'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -65,10 +65,10 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function showRegistrationForm() |
67 | 67 | { |
68 | - return view('auth.register', [ |
|
69 | - 'routes' => $this->auth_routes(), |
|
70 | - 'register' => Lang::get('common/auth/register'), |
|
71 | - 'home_url' => route('home'), |
|
68 | + return view ('auth.register', [ |
|
69 | + 'routes' => $this->auth_routes (), |
|
70 | + 'register' => Lang::get ('common/auth/register'), |
|
71 | + 'home_url' => route ('home'), |
|
72 | 72 | ]); |
73 | 73 | } |
74 | 74 | |
@@ -79,12 +79,12 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function showManagerRegistrationForm() |
81 | 81 | { |
82 | - return view('auth.register_manager', [ |
|
83 | - 'routes' => $this->auth_routes(), |
|
84 | - 'register' => Lang::get('common/auth/register'), |
|
85 | - 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')], |
|
86 | - 'departments' => Department::all(), |
|
87 | - 'home_url' => route('manager.home'), |
|
82 | + return view ('auth.register_manager', [ |
|
83 | + 'routes' => $this->auth_routes (), |
|
84 | + 'register' => Lang::get ('common/auth/register'), |
|
85 | + 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')], |
|
86 | + 'departments' => Department::all (), |
|
87 | + 'home_url' => route ('manager.home'), |
|
88 | 88 | ]); |
89 | 89 | } |
90 | 90 | |
@@ -95,12 +95,12 @@ discard block |
||
95 | 95 | */ |
96 | 96 | public function showHrRegistrationForm() |
97 | 97 | { |
98 | - return view('auth.register_manager', [ |
|
99 | - 'routes' => $this->auth_routes(), |
|
100 | - 'register' => Lang::get('common/auth/register'), |
|
101 | - 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get('common/auth/register.not_in_gov')], |
|
102 | - 'departments' => Department::all(), |
|
103 | - 'home_url' => route('hr_advisor.home'), |
|
98 | + return view ('auth.register_manager', [ |
|
99 | + 'routes' => $this->auth_routes (), |
|
100 | + 'register' => Lang::get ('common/auth/register'), |
|
101 | + 'not_in_gov_option' => ['value' => 0, 'name' => Lang::get ('common/auth/register.not_in_gov')], |
|
102 | + 'departments' => Department::all (), |
|
103 | + 'home_url' => route ('hr_advisor.home'), |
|
104 | 104 | ]); |
105 | 105 | } |
106 | 106 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | */ |
114 | 114 | protected function validator(array $data) |
115 | 115 | { |
116 | - return RegistrationValidator::userValidator($data); |
|
116 | + return RegistrationValidator::userValidator ($data); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | protected function managerValidator(array $data) |
126 | 126 | { |
127 | - return RegistrationValidator::managerValidator($data); |
|
127 | + return RegistrationValidator::managerValidator ($data); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | protected function hrValidator(array $data) |
137 | 137 | { |
138 | - return RegistrationValidator::hrValidator($data); |
|
138 | + return RegistrationValidator::hrValidator ($data); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
@@ -146,20 +146,20 @@ discard block |
||
146 | 146 | */ |
147 | 147 | protected function create(array $data) |
148 | 148 | { |
149 | - $user = new User(); |
|
149 | + $user = new User (); |
|
150 | 150 | $user->first_name = $data['first_name']; |
151 | 151 | $user->last_name = $data['last_name']; |
152 | 152 | $user->email = $data['email']; |
153 | - $user->password = Hash::make($data['password']); |
|
153 | + $user->password = Hash::make ($data['password']); |
|
154 | 154 | |
155 | 155 | // Default to basic user. |
156 | - $user->setRole('basic'); |
|
156 | + $user->setRole ('basic'); |
|
157 | 157 | |
158 | - $user->save(); |
|
158 | + $user->save (); |
|
159 | 159 | |
160 | - $user->applicant()->save(new Applicant()); |
|
160 | + $user->applicant ()->save (new Applicant ()); |
|
161 | 161 | |
162 | - return $user->fresh(); |
|
162 | + return $user->fresh (); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -171,28 +171,28 @@ discard block |
||
171 | 171 | protected function createManager(array $data) |
172 | 172 | { |
173 | 173 | // Create basic user. |
174 | - $user = $this->create($data); |
|
174 | + $user = $this->create ($data); |
|
175 | 175 | |
176 | 176 | // Save manager specific fields. |
177 | - $managerDepartment = Department::find($data['department']); |
|
177 | + $managerDepartment = Department::find ($data['department']); |
|
178 | 178 | $inGovernment = ($managerDepartment !== null); |
179 | 179 | $user->not_in_gov = !$inGovernment; |
180 | 180 | $user->gov_email = $inGovernment ? $data['gov_email'] : null; |
181 | - $user->save(); |
|
182 | - $user->refresh(); |
|
181 | + $user->save (); |
|
182 | + $user->refresh (); |
|
183 | 183 | |
184 | 184 | // Add (or update) manager profile. |
185 | 185 | // NOTE: modifying a field in $user, and saving it, appears to create Manager object. I don't know how. -- Tristan |
186 | 186 | // That means that after setting not_in_gov or gov_email, a manager already exists here. Adding a new one will throw an exception. |
187 | 187 | $department_id = $inGovernment ? $managerDepartment->id : null; |
188 | 188 | if ($user->manager === null) { |
189 | - $user->applicant()->save(new Manager()); |
|
190 | - $user->refresh(); |
|
189 | + $user->applicant ()->save (new Manager ()); |
|
190 | + $user->refresh (); |
|
191 | 191 | } |
192 | 192 | $user->manager->department_id = $department_id; |
193 | - $user->manager->save(); |
|
193 | + $user->manager->save (); |
|
194 | 194 | |
195 | - return $user->fresh(); |
|
195 | + return $user->fresh (); |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | /** |
@@ -204,28 +204,28 @@ discard block |
||
204 | 204 | protected function createHrAdvisor(array $data) |
205 | 205 | { |
206 | 206 | // Create basic user. |
207 | - $user = $this->create($data); |
|
207 | + $user = $this->create ($data); |
|
208 | 208 | |
209 | 209 | // Save hr_advisor specific fields (same as manager). |
210 | - $hrDepartment = Department::find($data['department']); |
|
210 | + $hrDepartment = Department::find ($data['department']); |
|
211 | 211 | $inGovernment = ($hrDepartment !== null); |
212 | 212 | $user->not_in_gov = !$inGovernment; |
213 | 213 | $user->gov_email = $inGovernment ? $data['gov_email'] : null; |
214 | - $user->setRole('hr_advisor'); |
|
214 | + $user->setRole ('hr_advisor'); |
|
215 | 215 | |
216 | - $user->save(); |
|
217 | - $user->refresh(); |
|
216 | + $user->save (); |
|
217 | + $user->refresh (); |
|
218 | 218 | |
219 | 219 | $department_id = $inGovernment ? $hrDepartment->id : null; |
220 | 220 | if ($user->hr_advisor === null) { |
221 | - $user->hr_advisor()->save(new HrAdvisor()); |
|
222 | - $user->refresh(); |
|
221 | + $user->hr_advisor ()->save (new HrAdvisor ()); |
|
222 | + $user->refresh (); |
|
223 | 223 | } |
224 | 224 | $user->hr_advisor->department_id = $department_id; |
225 | 225 | $user->hr_advisor->user_id === $user->id; |
226 | - $user->hr_advisor->save(); |
|
226 | + $user->hr_advisor->save (); |
|
227 | 227 | |
228 | - return $user->fresh(); |
|
228 | + return $user->fresh (); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | /** |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | */ |
239 | 239 | protected function registered(Request $request, $user) |
240 | 240 | { |
241 | - return redirect()->intended($this->redirectTo()); |
|
241 | + return redirect ()->intended ($this->redirectTo ()); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -250,14 +250,14 @@ discard block |
||
250 | 250 | */ |
251 | 251 | public function registerManager(Request $request) |
252 | 252 | { |
253 | - $this->managerValidator($request->all())->validate(); |
|
253 | + $this->managerValidator ($request->all ())->validate (); |
|
254 | 254 | |
255 | - event(new Registered($user = $this->createManager($request->all()))); |
|
255 | + event (new Registered ($user = $this->createManager ($request->all ()))); |
|
256 | 256 | |
257 | - $this->guard()->login($user); |
|
257 | + $this->guard ()->login ($user); |
|
258 | 258 | |
259 | - return $this->registered($request, $user) |
|
260 | - ?: redirect($this->redirectPath()); |
|
259 | + return $this->registered ($request, $user) |
|
260 | + ?: redirect ($this->redirectPath ()); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | */ |
270 | 270 | public function registerHrAdvisor(Request $request) |
271 | 271 | { |
272 | - $this->hrValidator($request->all())->validate(); |
|
272 | + $this->hrValidator ($request->all ())->validate (); |
|
273 | 273 | |
274 | - event(new Registered($user = $this->createHrAdvisor($request->all()))); |
|
274 | + event (new Registered ($user = $this->createHrAdvisor ($request->all ()))); |
|
275 | 275 | |
276 | - $this->guard()->login($user); |
|
276 | + $this->guard ()->login ($user); |
|
277 | 277 | |
278 | - return redirect(route('hr_advisor.home')); |
|
278 | + return redirect (route ('hr_advisor.home')); |
|
279 | 279 | } |
280 | 280 | } |