@@ -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 | } |
@@ -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 | } |
@@ -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], |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function show(Request $request, Manager $manager) |
28 | 28 | { |
29 | - $manager_profile = Lang::get('applicant/manager_profile'); |
|
29 | + $manager_profile = Lang::get ('applicant/manager_profile'); |
|
30 | 30 | |
31 | 31 | $manager_profile_sections = [ |
32 | 32 | [ |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | ] |
66 | 66 | ]; |
67 | 67 | |
68 | - return view('applicant/manager', [ |
|
68 | + return view ('applicant/manager', [ |
|
69 | 69 | 'manager_profile' => $manager_profile, |
70 | - 'urls' => Lang::get('common/urls'), |
|
70 | + 'urls' => Lang::get ('common/urls'), |
|
71 | 71 | 'manager' => $manager, |
72 | 72 | 'manager_profile_photo_url' => '/images/user.png', // TODO get real photo. |
73 | 73 | 'manager_profile_sections' => $manager_profile_sections, |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function editAuthenticated(Request $request) |
85 | 85 | { |
86 | - $manager = $request->user()->manager; |
|
87 | - return redirect(route('manager.profile.edit', $manager)); |
|
86 | + $manager = $request->user ()->manager; |
|
87 | + return redirect (route ('manager.profile.edit', $manager)); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -99,25 +99,25 @@ discard block |
||
99 | 99 | // TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model. |
100 | 100 | $workplacePhotos = []; |
101 | 101 | |
102 | - $frequencies = Frequency::all(); |
|
102 | + $frequencies = Frequency::all (); |
|
103 | 103 | $linkedInUrlPattern = LinkedInUrlRule::PATTERN; |
104 | 104 | $twitterHandlePattern = TwitterHandleRule::PATTERN; |
105 | 105 | |
106 | - return view('manager/profile', [ |
|
106 | + return view ('manager/profile', [ |
|
107 | 107 | // Localization. |
108 | - 'profile_l10n' => Lang::get('manager/profile'), |
|
108 | + 'profile_l10n' => Lang::get ('manager/profile'), |
|
109 | 109 | // Data. |
110 | - 'urls' => Lang::get('common/urls'), |
|
110 | + 'urls' => Lang::get ('common/urls'), |
|
111 | 111 | 'user' => $manager->user, |
112 | 112 | 'manager' => $manager, |
113 | 113 | 'manager_profile_photo_url' => '/images/user.png', // TODO get real photo. |
114 | 114 | 'workplace_photos' => $workplacePhotos, |
115 | - 'departments' => Department::all(), |
|
115 | + 'departments' => Department::all (), |
|
116 | 116 | 'telework_options' => $frequencies, |
117 | 117 | 'flex_hour_options' => $frequencies, |
118 | 118 | 'radio_options' => $frequencies, |
119 | - 'managerEN' => $manager->translate('en'), |
|
120 | - 'managerFR' => $manager->translate('fr'), |
|
119 | + 'managerEN' => $manager->translate ('en'), |
|
120 | + 'managerFR' => $manager->translate ('fr'), |
|
121 | 121 | 'linkedInUrlPattern' => $linkedInUrlPattern, |
122 | 122 | 'twitterHandlePattern' => $twitterHandlePattern, |
123 | 123 | ]); |
@@ -134,27 +134,27 @@ discard block |
||
134 | 134 | { |
135 | 135 | // TODO: save workplace Photos. |
136 | 136 | // TODO: remove control of name in production. |
137 | - $input = $request->input(); |
|
137 | + $input = $request->input (); |
|
138 | 138 | |
139 | 139 | // redirect to error messages element if validation fails |
140 | - if (isset($request->validator) && $request->validator->fails()) { |
|
140 | + if (isset($request->validator) && $request->validator->fails ()) { |
|
141 | 141 | $hash = '#managerProfileFormErrors'; |
142 | - return redirect(route('manager.profile.edit', $manager).$hash) |
|
143 | - ->withErrors($request->validator) |
|
144 | - ->withInput(); |
|
142 | + return redirect (route ('manager.profile.edit', $manager).$hash) |
|
143 | + ->withErrors ($request->validator) |
|
144 | + ->withInput (); |
|
145 | 145 | } |
146 | 146 | |
147 | - $validated = $request->validated(); |
|
147 | + $validated = $request->validated (); |
|
148 | 148 | |
149 | 149 | $user = $manager->user; |
150 | - $user->fill($validated); |
|
150 | + $user->fill ($validated); |
|
151 | 151 | if (!empty($input['new_password'])) { |
152 | - $user->password = Hash::make($input['new_password']); |
|
152 | + $user->password = Hash::make ($input['new_password']); |
|
153 | 153 | } |
154 | - $user->save(); |
|
154 | + $user->save (); |
|
155 | 155 | |
156 | - $manager->fill($validated); |
|
157 | - $manager->save(); |
|
156 | + $manager->fill ($validated); |
|
157 | + $manager->save (); |
|
158 | 158 | |
159 | 159 | // Use the button that was clicked to decide which element to redirect to. |
160 | 160 | switch ($input['submit']) { |
@@ -172,18 +172,18 @@ discard block |
||
172 | 172 | break; |
173 | 173 | } |
174 | 174 | |
175 | - return redirect(route('manager.profile.edit', $manager).$hash); |
|
175 | + return redirect (route ('manager.profile.edit', $manager).$hash); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | public function faq(Request $request) |
179 | 179 | { |
180 | - $show_demo_notification = $request->user() && $request->user()->isDemoManager(); |
|
180 | + $show_demo_notification = $request->user () && $request->user ()->isDemoManager (); |
|
181 | 181 | |
182 | - return view( |
|
182 | + return view ( |
|
183 | 183 | 'applicant/static_faq', |
184 | 184 | [ |
185 | - 'breadcrumb_home' => route('manager.home'), |
|
186 | - 'faq' => Lang::get('applicant/faq'), |
|
185 | + 'breadcrumb_home' => route ('manager.home'), |
|
186 | + 'faq' => Lang::get ('applicant/faq'), |
|
187 | 187 | 'manager_sidebar_active' => 'active', |
188 | 188 | 'show_demo_notification' => $show_demo_notification, |
189 | 189 | ] |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | public function __construct() |
23 | 23 | { |
24 | 24 | // This applies the appropriate policy to each resource route. |
25 | - $this->authorizeResource(JobPoster::class, 'job'); |
|
25 | + $this->authorizeResource (JobPoster::class, 'job'); |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | /** |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | */ |
36 | 36 | private function jobToArray(JobPoster $job) |
37 | 37 | { |
38 | - $criteria = Criteria::where('job_poster_id', $job->id)->get(); |
|
38 | + $criteria = Criteria::where ('job_poster_id', $job->id)->get (); |
|
39 | 39 | |
40 | - $toApiArray = function ($model) { |
|
41 | - return array_merge($model->toArray(), $model->getTranslationsArray()); |
|
40 | + $toApiArray = function ($model){ |
|
41 | + return array_merge ($model->toArray (), $model->getTranslationsArray ()); |
|
42 | 42 | }; |
43 | - $criteriaTranslated = $criteria->map($toApiArray); |
|
43 | + $criteriaTranslated = $criteria->map ($toApiArray); |
|
44 | 44 | |
45 | - $jobArray = array_merge($job->toApiArray(), ['criteria' => $criteriaTranslated]); |
|
45 | + $jobArray = array_merge ($job->toApiArray (), ['criteria' => $criteriaTranslated]); |
|
46 | 46 | return $jobArray; |
47 | 47 | } |
48 | 48 | /** |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | */ |
64 | 64 | public function store(StoreJobPoster $request) |
65 | 65 | { |
66 | - $data = $request->validated(); |
|
67 | - $job = new JobPoster(); |
|
68 | - $job->manager_id = $request->user()->manager->id; |
|
66 | + $data = $request->validated (); |
|
67 | + $job = new JobPoster (); |
|
68 | + $job->manager_id = $request->user ()->manager->id; |
|
69 | 69 | // Defaulting JPB created Jobs to monthly terms for now. |
70 | - $job->job_term_id = JobTerm::where('name', 'month')->value('id'); |
|
71 | - $job->fill($data); |
|
72 | - $job->save(); |
|
73 | - return response()->json($this->jobToArray($job)); |
|
70 | + $job->job_term_id = JobTerm::where ('name', 'month')->value ('id'); |
|
71 | + $job->fill ($data); |
|
72 | + $job->save (); |
|
73 | + return response ()->json ($this->jobToArray ($job)); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function show(JobPoster $job) |
83 | 83 | { |
84 | - return response()->json($this->jobToArray($job)); |
|
84 | + return response ()->json ($this->jobToArray ($job)); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -93,14 +93,14 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function update(UpdateJobPoster $request, JobPoster $job) |
95 | 95 | { |
96 | - $data = $request->validated(); |
|
96 | + $data = $request->validated (); |
|
97 | 97 | // Only values both in the JobPoster->fillable array, |
98 | 98 | // and returned by UpdateJobPoster->validatedData(), will be set. |
99 | - $job->fill($data); |
|
99 | + $job->fill ($data); |
|
100 | 100 | // Defaulting JPB updated jobs to monthly for now. |
101 | - $job->job_term_id = JobTerm::where('name', 'month')->value('id'); |
|
102 | - $job->save(); |
|
103 | - return response()->json($this->jobToArray($job->fresh())); |
|
101 | + $job->job_term_id = JobTerm::where ('name', 'month')->value ('id'); |
|
102 | + $job->save (); |
|
103 | + return response ()->json ($this->jobToArray ($job->fresh ())); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -125,18 +125,18 @@ discard block |
||
125 | 125 | // Check to avoid submitting for review multiple times. |
126 | 126 | if ($job->review_requested_at === null) { |
127 | 127 | // Update review request timestamp. |
128 | - $job->review_requested_at = new Date(); |
|
129 | - $job->save(); |
|
128 | + $job->review_requested_at = new Date (); |
|
129 | + $job->save (); |
|
130 | 130 | |
131 | 131 | // Send email. |
132 | - $reviewer_email = config('mail.reviewer_email'); |
|
132 | + $reviewer_email = config ('mail.reviewer_email'); |
|
133 | 133 | if (isset($reviewer_email)) { |
134 | - Mail::to($reviewer_email)->send(new JobPosterReviewRequested($job, Auth::user())); |
|
134 | + Mail::to ($reviewer_email)->send (new JobPosterReviewRequested ($job, Auth::user ())); |
|
135 | 135 | } else { |
136 | - Log::error('The reviewer email environment variable is not set.'); |
|
136 | + Log::error ('The reviewer email environment variable is not set.'); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - return response()->json($this->jobToArray($job)); |
|
140 | + return response ()->json ($this->jobToArray ($job)); |
|
141 | 141 | } |
142 | 142 | } |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function toApiArray(JobPosterKeyTask $model) |
19 | 19 | { |
20 | - return array_merge($model->toArray(), $model->getTranslationsArray()); |
|
20 | + return array_merge ($model->toArray (), $model->getTranslationsArray ()); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | public function indexByJob(JobPoster $jobPoster) |
24 | 24 | { |
25 | 25 | $toApiArray = array($this, 'toApiArray'); |
26 | - $taskArray = JobPosterKeyTask::where('job_poster_id', $jobPoster->id)->get()->map($toApiArray); |
|
27 | - return response()->json($taskArray); |
|
26 | + $taskArray = JobPosterKeyTask::where ('job_poster_id', $jobPoster->id)->get ()->map ($toApiArray); |
|
27 | + return response ()->json ($taskArray); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -38,35 +38,35 @@ discard block |
||
38 | 38 | { |
39 | 39 | $toApiArray = array($this, 'toApiArray'); |
40 | 40 | |
41 | - $newTasks = collect($request->validated()); // Collection of JobPosterKeyTasks. |
|
41 | + $newTasks = collect ($request->validated ()); // Collection of JobPosterKeyTasks. |
|
42 | 42 | $oldTasks = $jobPoster->job_poster_key_tasks; |
43 | 43 | |
44 | 44 | $savedNewTaskIds = []; |
45 | 45 | |
46 | 46 | // First, delete old tasks that weren't resubmitted, and update those that were. |
47 | 47 | foreach ($oldTasks as $task) { |
48 | - $newTask = $newTasks->firstWhere('id', $task['id']); |
|
48 | + $newTask = $newTasks->firstWhere ('id', $task['id']); |
|
49 | 49 | if ($newTask) { |
50 | 50 | $savedNewTaskIds[] = $newTask['id']; |
51 | - $task->fill(collect($newTask)->only(['en', 'fr'])->toArray()); |
|
52 | - $task->save(); |
|
51 | + $task->fill (collect ($newTask)->only (['en', 'fr'])->toArray ()); |
|
52 | + $task->save (); |
|
53 | 53 | } else { |
54 | - $task->delete(); |
|
54 | + $task->delete (); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Now, save any new tasks that remain. |
59 | 59 | foreach ($newTasks as $task) { |
60 | - if ($this->isUnsaved($task, $savedNewTaskIds)) { |
|
61 | - $jobPosterTask = new JobPosterKeyTask(); |
|
60 | + if ($this->isUnsaved ($task, $savedNewTaskIds)) { |
|
61 | + $jobPosterTask = new JobPosterKeyTask (); |
|
62 | 62 | $jobPosterTask->job_poster_id = $jobPoster->id; |
63 | - $jobPosterTask->fill(collect($task)->only(['en', 'fr'])->toArray()); |
|
64 | - $jobPosterTask->save(); |
|
63 | + $jobPosterTask->fill (collect ($task)->only (['en', 'fr'])->toArray ()); |
|
64 | + $jobPosterTask->save (); |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | |
68 | - $taskArray = $jobPoster->fresh()->job_poster_key_tasks->map($toApiArray); |
|
69 | - return response()->json($taskArray); |
|
68 | + $taskArray = $jobPoster->fresh ()->job_poster_key_tasks->map ($toApiArray); |
|
69 | + return response ()->json ($taskArray); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -78,6 +78,6 @@ discard block |
||
78 | 78 | */ |
79 | 79 | private function isUnsaved($task, array $savedTaskIds): bool |
80 | 80 | { |
81 | - return !array_key_exists('id', $task) || !in_array($task['id'], $savedTaskIds); |
|
81 | + return !array_key_exists ('id', $task) || !in_array ($task['id'], $savedTaskIds); |
|
82 | 82 | } |
83 | 83 | } |