@@ -35,11 +35,11 @@ |
||
35 | 35 | |
36 | 36 | public function criteria() |
37 | 37 | { |
38 | - return $this->hasMany(\App\Models\Criteria::class); |
|
38 | + return $this->hasMany (\App\Models\Criteria::class); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function criteria_type_translations() //phpcs:ignore |
42 | 42 | { |
43 | - return $this->hasMany(\App\Models\CriteriaTypeTranslation::class); |
|
43 | + return $this->hasMany (\App\Models\CriteriaTypeTranslation::class); |
|
44 | 44 | } |
45 | 45 | } |
@@ -21,15 +21,15 @@ |
||
21 | 21 | * |
22 | 22 | * @property \App\Models\Lookup\ExperienceLevel $experience_level |
23 | 23 | */ |
24 | -class ExperienceLevelTranslation extends BaseModel { |
|
24 | +class ExperienceLevelTranslation extends BaseModel{ |
|
25 | 25 | |
26 | 26 | protected $casts = [ |
27 | 27 | 'experience_level_id' => 'int' |
28 | 28 | ]; |
29 | 29 | protected $fillable = []; |
30 | 30 | |
31 | - public function experience_level() { |
|
32 | - return $this->belongsTo(\App\Models\Lookup\ExperienceLevel::class); |
|
31 | + public function experience_level(){ |
|
32 | + return $this->belongsTo (\App\Models\Lookup\ExperienceLevel::class); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | } |
@@ -61,6 +61,6 @@ |
||
61 | 61 | |
62 | 62 | public function job_poster() |
63 | 63 | { |
64 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
64 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
65 | 65 | } |
66 | 66 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @property \App\Models\Manager $manager |
30 | 30 | */ |
31 | -class ManagerTranslation extends BaseModel { |
|
31 | +class ManagerTranslation extends BaseModel{ |
|
32 | 32 | |
33 | 33 | protected $casts = [ |
34 | 34 | 'manager_id' => 'int' |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | 'learning_path' |
47 | 47 | ]; |
48 | 48 | |
49 | - public function manager() { |
|
50 | - return $this->belongsTo(\App\Models\Manager::class); |
|
49 | + public function manager(){ |
|
50 | + return $this->belongsTo (\App\Models\Manager::class); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | } |
@@ -49,26 +49,26 @@ |
||
49 | 49 | |
50 | 50 | public function manager() |
51 | 51 | { |
52 | - return $this->belongsTo(\App\Models\Manager::class); |
|
52 | + return $this->belongsTo (\App\Models\Manager::class); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | public function telework_allowed_frequency() //phpcs:ignore |
56 | 56 | { |
57 | - return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
|
57 | + return $this->belongsTo (\App\Models\Lookup\Frequency::class); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | public function flexible_hours_frequency() //phpcs:ignore |
61 | 61 | { |
62 | - return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
|
62 | + return $this->belongsTo (\App\Models\Lookup\Frequency::class); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function workplace_photo_captions() //phpcs:ignore |
66 | 66 | { |
67 | - return $this->hasMany(\App\Models\WorkplacePhotoCaption::class); |
|
67 | + return $this->hasMany (\App\Models\WorkplacePhotoCaption::class); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | public function work_environment_translations() //phpcs:ignore |
71 | 71 | { |
72 | - return $this->hasMany(\App\Models\WorkEnvironmentTranslation::class); |
|
72 | + return $this->hasMany (\App\Models\WorkEnvironmentTranslation::class); |
|
73 | 73 | } |
74 | 74 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function index() |
25 | 25 | { |
26 | - $now = Carbon::now(); |
|
26 | + $now = Carbon::now (); |
|
27 | 27 | |
28 | 28 | // Find published jobs that are currently open for applications. |
29 | 29 | // Eager load required relationships: Department, Province, JobTerm. |
30 | 30 | // Eager load the count of submitted applications, to prevent the relationship |
31 | 31 | // from being actually loaded and firing off events. |
32 | - $jobs = JobPoster::where('open_date_time', '<=', $now) |
|
33 | - ->where('close_date_time', '>=', $now) |
|
34 | - ->where('published', true) |
|
35 | - ->with([ |
|
32 | + $jobs = JobPoster::where ('open_date_time', '<=', $now) |
|
33 | + ->where ('close_date_time', '>=', $now) |
|
34 | + ->where ('published', true) |
|
35 | + ->with ([ |
|
36 | 36 | 'department', |
37 | 37 | 'province', |
38 | 38 | 'job_term', |
39 | 39 | ]) |
40 | - ->withCount([ |
|
40 | + ->withCount ([ |
|
41 | 41 | 'submitted_applications', |
42 | 42 | ]) |
43 | - ->get(); |
|
44 | - return view('applicant/job_index', [ |
|
45 | - 'job_index' => Lang::get('applicant/job_index'), |
|
43 | + ->get (); |
|
44 | + return view ('applicant/job_index', [ |
|
45 | + 'job_index' => Lang::get ('applicant/job_index'), |
|
46 | 46 | 'jobs' => $jobs |
47 | 47 | ]); |
48 | 48 | } |
@@ -54,31 +54,31 @@ discard block |
||
54 | 54 | */ |
55 | 55 | public function managerIndex() |
56 | 56 | { |
57 | - $manager = Auth::user()->manager; |
|
57 | + $manager = Auth::user ()->manager; |
|
58 | 58 | |
59 | - $jobs = JobPoster::where('manager_id', $manager->id) |
|
60 | - ->with('classification') |
|
61 | - ->withCount('submitted_applications') |
|
62 | - ->get(); |
|
59 | + $jobs = JobPoster::where ('manager_id', $manager->id) |
|
60 | + ->with ('classification') |
|
61 | + ->withCount ('submitted_applications') |
|
62 | + ->get (); |
|
63 | 63 | |
64 | 64 | foreach ($jobs as &$job) { |
65 | 65 | $chosen_lang = $job->chosen_lang; |
66 | 66 | |
67 | 67 | // Show chosen lang title if current title is empty. |
68 | 68 | if (empty($job->title)) { |
69 | - $job->title = $job->translate($chosen_lang)->title; |
|
69 | + $job->title = $job->translate ($chosen_lang)->title; |
|
70 | 70 | $job->trans_required = true; |
71 | 71 | } |
72 | 72 | |
73 | 73 | // Always preview and edit in the chosen language. |
74 | - $job->preview_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.show', $job)); |
|
75 | - $job->edit_link = LaravelLocalization::getLocalizedURL($chosen_lang, route('manager.jobs.edit', $job)); |
|
74 | + $job->preview_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.show', $job)); |
|
75 | + $job->edit_link = LaravelLocalization::getLocalizedURL ($chosen_lang, route ('manager.jobs.edit', $job)); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | |
79 | - return view('manager/job_index', [ |
|
79 | + return view ('manager/job_index', [ |
|
80 | 80 | // Localization Strings. |
81 | - 'jobs_l10n' => Lang::get('manager/job_index'), |
|
81 | + 'jobs_l10n' => Lang::get ('manager/job_index'), |
|
82 | 82 | // Data. |
83 | 83 | 'jobs' => $jobs, |
84 | 84 | ]); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function destroy(Request $request, JobPoster $jobPoster) |
95 | 95 | { |
96 | - $jobPoster->delete(); |
|
96 | + $jobPoster->delete (); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function show(Request $request, JobPoster $jobPoster) |
107 | 107 | { |
108 | - $jobPoster->load([ |
|
108 | + $jobPoster->load ([ |
|
109 | 109 | 'department', |
110 | 110 | 'criteria.skill.skill_type', |
111 | 111 | 'manager.team_culture', |
112 | 112 | 'manager.work_environment' |
113 | 113 | ]); |
114 | 114 | |
115 | - $user = Auth::user(); |
|
115 | + $user = Auth::user (); |
|
116 | 116 | |
117 | 117 | // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model. |
118 | 118 | $workplacePhotos = []; |
@@ -125,36 +125,36 @@ discard block |
||
125 | 125 | |
126 | 126 | // TODO: replace route('manager.show',manager.id) in templates with link using slug. |
127 | 127 | $criteria = [ |
128 | - 'essential' => $jobPoster->criteria->filter( |
|
129 | - function ($value, $key) { |
|
128 | + 'essential' => $jobPoster->criteria->filter ( |
|
129 | + function ($value, $key){ |
|
130 | 130 | return $value->criteria_type->name == 'essential'; |
131 | 131 | } |
132 | 132 | ), |
133 | - 'asset' => $jobPoster->criteria->filter( |
|
134 | - function ($value, $key) { |
|
133 | + 'asset' => $jobPoster->criteria->filter ( |
|
134 | + function ($value, $key){ |
|
135 | 135 | return $value->criteria_type->name == 'asset'; |
136 | 136 | } |
137 | 137 | ), |
138 | 138 | ]; |
139 | 139 | |
140 | - $jobLang = Lang::get('applicant/job_post'); |
|
140 | + $jobLang = Lang::get ('applicant/job_post'); |
|
141 | 141 | |
142 | 142 | $applyButton = []; |
143 | - if (!$jobPoster->published && $this->authorize('update', $jobPoster)) { |
|
143 | + if (!$jobPoster->published && $this->authorize ('update', $jobPoster)) { |
|
144 | 144 | $applyButton = [ |
145 | - 'href' => route('manager.jobs.edit', $jobPoster->id), |
|
145 | + 'href' => route ('manager.jobs.edit', $jobPoster->id), |
|
146 | 146 | 'title' => $jobLang['apply']['edit_link_title'], |
147 | 147 | 'text' => $jobLang['apply']['edit_link_label'], |
148 | 148 | ]; |
149 | - } elseif (Auth::check() && $jobPoster->isOpen()) { |
|
149 | + } elseif (Auth::check () && $jobPoster->isOpen ()) { |
|
150 | 150 | $applyButton = [ |
151 | - 'href' => route('job.application.edit.1', $jobPoster->id), |
|
151 | + 'href' => route ('job.application.edit.1', $jobPoster->id), |
|
152 | 152 | 'title' => $jobLang['apply']['apply_link_title'], |
153 | 153 | 'text' => $jobLang['apply']['apply_link_label'], |
154 | 154 | ]; |
155 | - } elseif (Auth::guest() && $jobPoster->isOpen()) { |
|
155 | + } elseif (Auth::guest () && $jobPoster->isOpen ()) { |
|
156 | 156 | $applyButton = [ |
157 | - 'href' => route('job.application.edit.1', $jobPoster->id), |
|
157 | + 'href' => route ('job.application.edit.1', $jobPoster->id), |
|
158 | 158 | 'title' => $jobLang['apply']['login_link_title'], |
159 | 159 | 'text' => $jobLang['apply']['login_link_label'], |
160 | 160 | ]; |
@@ -166,19 +166,19 @@ discard block |
||
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 | } |
@@ -217,20 +217,20 @@ discard block |
||
217 | 217 | { |
218 | 218 | $manager = $jobPoster->manager; |
219 | 219 | |
220 | - if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count() === 0) { |
|
221 | - $jobPoster->job_poster_questions()->saveMany($this->populateDefaultQuestions()); |
|
222 | - $jobPoster->refresh(); |
|
220 | + if ($jobPoster->job_poster_questions === null || $jobPoster->job_poster_questions->count () === 0) { |
|
221 | + $jobPoster->job_poster_questions ()->saveMany ($this->populateDefaultQuestions ()); |
|
222 | + $jobPoster->refresh (); |
|
223 | 223 | } |
224 | 224 | |
225 | - return view( |
|
225 | + return view ( |
|
226 | 226 | 'manager/job_create', |
227 | 227 | [ |
228 | 228 | // Localization Strings. |
229 | - 'job_l10n' => Lang::get('manager/job_edit'), |
|
229 | + 'job_l10n' => Lang::get ('manager/job_edit'), |
|
230 | 230 | // Data. |
231 | 231 | 'manager' => $manager, |
232 | 232 | 'job' => $jobPoster, |
233 | - 'form_action_url' => route('admin.jobs.update', $jobPoster), |
|
233 | + 'form_action_url' => route ('admin.jobs.update', $jobPoster), |
|
234 | 234 | ] |
235 | 235 | ); |
236 | 236 | } |
@@ -243,21 +243,21 @@ discard block |
||
243 | 243 | */ |
244 | 244 | public function createAsManager(Manager $manager) |
245 | 245 | { |
246 | - $jobPoster = new JobPoster(); |
|
246 | + $jobPoster = new JobPoster (); |
|
247 | 247 | $jobPoster->manager_id = $manager->id; |
248 | 248 | |
249 | 249 | // Save manager-specific info to the job poster - equivalent to the intro step of the JPB |
250 | - $divisionEn = $manager->translate('en') !== null ? $manager->translate('en')->division : null; |
|
251 | - $divisionFr = $manager->translate('fr') !== null ? $manager->translate('fr')->division : null; |
|
252 | - $jobPoster->fill([ |
|
250 | + $divisionEn = $manager->translate ('en') !== null ? $manager->translate ('en')->division : null; |
|
251 | + $divisionFr = $manager->translate ('fr') !== null ? $manager->translate ('fr')->division : null; |
|
252 | + $jobPoster->fill ([ |
|
253 | 253 | 'department_id' => $manager->department_id, |
254 | 254 | 'en' => ['division' => $divisionEn], |
255 | 255 | 'fr' => ['division' => $divisionFr], |
256 | 256 | ]); |
257 | 257 | |
258 | - $jobPoster->save(); |
|
258 | + $jobPoster->save (); |
|
259 | 259 | |
260 | - return redirect()->route('manager.jobs.edit', $jobPoster->id); |
|
260 | + return redirect ()->route ('manager.jobs.edit', $jobPoster->id); |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | /** |
@@ -272,19 +272,19 @@ discard block |
||
272 | 272 | { |
273 | 273 | // Don't allow edits for published Job Posters |
274 | 274 | // Also check auth while we're at it. |
275 | - $this->authorize('update', $jobPoster); |
|
276 | - JobPosterValidator::validateUnpublished($jobPoster); |
|
275 | + $this->authorize ('update', $jobPoster); |
|
276 | + JobPosterValidator::validateUnpublished ($jobPoster); |
|
277 | 277 | |
278 | - $input = $request->input(); |
|
278 | + $input = $request->input (); |
|
279 | 279 | |
280 | 280 | if ($jobPoster->manager_id == null) { |
281 | - $jobPoster->manager_id = $request->user()->manager->id; |
|
282 | - $jobPoster->save(); |
|
281 | + $jobPoster->manager_id = $request->user ()->manager->id; |
|
282 | + $jobPoster->save (); |
|
283 | 283 | } |
284 | 284 | |
285 | - $this->fillAndSaveJobPosterQuestions($input, $jobPoster, true); |
|
285 | + $this->fillAndSaveJobPosterQuestions ($input, $jobPoster, true); |
|
286 | 286 | |
287 | - return redirect(route('manager.jobs.show', $jobPoster->id)); |
|
287 | + return redirect (route ('manager.jobs.show', $jobPoster->id)); |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | /** |
@@ -298,17 +298,17 @@ discard block |
||
298 | 298 | protected function fillAndSaveJobPosterQuestions(array $input, JobPoster $jobPoster, bool $replace) : void |
299 | 299 | { |
300 | 300 | if ($replace) { |
301 | - $jobPoster->job_poster_questions()->delete(); |
|
301 | + $jobPoster->job_poster_questions ()->delete (); |
|
302 | 302 | } |
303 | 303 | |
304 | - if (!array_key_exists('question', $input) || !is_array($input['question'])) { |
|
304 | + if (!array_key_exists ('question', $input) || !is_array ($input['question'])) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
308 | 308 | foreach ($input['question'] as $question) { |
309 | - $jobQuestion = new JobPosterQuestion(); |
|
309 | + $jobQuestion = new JobPosterQuestion (); |
|
310 | 310 | $jobQuestion->job_poster_id = $jobPoster->id; |
311 | - $jobQuestion->fill( |
|
311 | + $jobQuestion->fill ( |
|
312 | 312 | [ |
313 | 313 | 'en' => [ |
314 | 314 | 'question' => $question['question']['en'], |
@@ -320,8 +320,8 @@ discard block |
||
320 | 320 | ] |
321 | 321 | ] |
322 | 322 | ); |
323 | - $jobPoster->save(); |
|
324 | - $jobQuestion->save(); |
|
323 | + $jobPoster->save (); |
|
324 | + $jobQuestion->save (); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
@@ -333,20 +333,20 @@ discard block |
||
333 | 333 | protected function populateDefaultQuestions() |
334 | 334 | { |
335 | 335 | $defaultQuestions = [ |
336 | - 'en' => array_values(Lang::get('manager/job_create', [], 'en')['questions']), |
|
337 | - 'fr' => array_values(Lang::get('manager/job_create', [], 'fr')['questions']), |
|
336 | + 'en' => array_values (Lang::get ('manager/job_create', [], 'en')['questions']), |
|
337 | + 'fr' => array_values (Lang::get ('manager/job_create', [], 'fr')['questions']), |
|
338 | 338 | ]; |
339 | 339 | |
340 | - if (count($defaultQuestions['en']) !== count($defaultQuestions['fr'])) { |
|
341 | - Log::warning('There must be the same number of French and English default questions for a Job Poster.'); |
|
340 | + if (count ($defaultQuestions['en']) !== count ($defaultQuestions['fr'])) { |
|
341 | + Log::warning ('There must be the same number of French and English default questions for a Job Poster.'); |
|
342 | 342 | return; |
343 | 343 | } |
344 | 344 | |
345 | 345 | $jobQuestions = []; |
346 | 346 | |
347 | - for ($i = 0; $i < count($defaultQuestions['en']); $i++) { |
|
348 | - $jobQuestion = new JobPosterQuestion(); |
|
349 | - $jobQuestion->fill( |
|
347 | + for ($i = 0; $i < count ($defaultQuestions['en']); $i++) { |
|
348 | + $jobQuestion = new JobPosterQuestion (); |
|
349 | + $jobQuestion->fill ( |
|
350 | 350 | [ |
351 | 351 | 'en' => [ |
352 | 352 | 'question' => $defaultQuestions['en'][$i], |