Completed
Push — docker_config ( 42a13c...d3c563 )
by Grant
12:41 queued 06:15
created

JobController::managerIndex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 9
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace App\Http\Controllers;
4
5
use Illuminate\Support\Facades\Lang;
6
use Illuminate\Support\Facades\Auth;
7
use Illuminate\Http\Request;
8
use Barryvdh\Debugbar\Facade as Debugbar;
9
use App\Http\Controllers\Controller;
10
use Carbon\Carbon;
11
use App\Models\JobPoster;
12
use App\Models\Lookup\JobTerm;
13
use App\Models\Lookup\Province;
14
use App\Models\Lookup\SecurityClearance;
15
use App\Models\Lookup\LanguageRequirement;
16
use App\Models\Lookup\Department;
17
use App\Models\Lookup\SkillLevel;
18
use App\Models\Lookup\CriteriaType;
19
use App\Models\Criteria;
20
use App\Models\Skill;
21
use App\Models\JobPosterQuestion;
22
use App\Models\JobPosterKeyTask;
23
use Jenssegers\Date\Date;
24
25
class JobController extends Controller
0 ignored issues
show
Coding Style introduced by
Missing doc comment for class JobController
Loading history...
26
{
27
    /**
28
     * Display a listing of JobPosters.
29
     *
30
     * @return \Illuminate\Http\Response
31
     */
32
    public function index()
33
    {
34
        $now = Carbon::now();
35
        //Find published jobs that are currently open for applications
36
        $jobs = JobPoster::where('open_date_time', '<=', $now)
37
            ->where('close_date_time', '>=', $now)
38
            ->where('published', true)
39
            ->get();
40
        $jobs->load('manager.work_environment');
41
        debugbar()->info($jobs->toArray());
42
        return view('applicant/job_index', ['job_index' => Lang::get('applicant/job_index'),
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/j...ex'), 'jobs' => $jobs)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
43
            'jobs' => $jobs]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
44
    }
45
46
    /**
47
     * Display a listing of a manager's JobPosters.
48
     *
49
     * @return \Illuminate\Http\Response
50
     */
51
    public function managerIndex()
52
    {
53
        $manager = Auth::user()->manager;
0 ignored issues
show
Bug introduced by
Accessing manager on the interface Illuminate\Contracts\Auth\Authenticatable suggest that you code against a concrete implementation. How about adding an instanceof check?
Loading history...
54
55
        return view('manager/job_index', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('manager/job...$manager->job_posters)) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
56
            "manager_job_index" => [
57
                "title" => "My Job Posts"
58
            ],
59
            'jobs' => $manager->job_posters,
60
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
61
62
        // return view('manager/job_index', [
63
        //     "manager_job_index" => [
64
        //         "title" => "My Job Posts"
65
        //     ],
66
        //     "user" => [
67
        //         "posts" => [
68
        //             "00" => [
69
        //                 "status" => "draft",
70
        //                 "link" => "/browse/jobs/00/",
71
        //                 "title" => "Front-end Developer",
72
        //                 "department" => "Treasury Board of Canada Secretariat",
73
        //                 "city" => "Ottawa",
74
        //                 "province" => "Ontario",
75
        //                 "salary" => "80,000 - 120,000",
76
        //                 "duration" => "1 Year",
77
        //                 "remote" => "Allowed",
78
        //                 "telework" => "Allowed",
79
        //                 "time_flexibility" => "Allowed",
80
        //                 "end_date" => "2018-04-09",
81
        //                 "days_remaining" => "12",
82
        //                 "applicants" => "2",
83
        //                 "reference_id" => "14234",
84
        //                 "start" => "January 3rd, 2019",
85
        //                 "language" => "English Essential",
86
        //                 "security" => "Top Secret",
87
        //                 "classification" => "CS3",
88
        //                 "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
89
        //                 "work" => [
90
        //                     "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
91
        //                     "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
92
        //                     "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
93
        //                 ],
94
        //                 "criteria" => [
95
        //                     "essential" => [
96
        //                         "00" => "Criteria 01",
97
        //                         "01" => "Criteria 02",
98
        //                         "02" => "Criteria 03"
99
        //                     ],
100
        //                     "asset" => [
101
        //                         "00" => "Criteria 01",
102
        //                         "01" => "Criteria 02",
103
        //                         "02" => "Criteria 03"
104
        //                     ]
105
        //                 ],
106
        //                 "extras" => [
107
        //                     "00" => [
108
        //                         "title" => "What You Need for Security Clearance",
109
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
110
        //                     ],
111
        //                     "01" => [
112
        //                         "title" => "The Application Process",
113
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
114
        //                     ],
115
        //                     "02" => [
116
        //                         "title" => "Other Paperwork & Preparation",
117
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
118
        //                     ]
119
        //                 ]
120
        //             ],
121
        //             "01" => [
122
        //                 "status" => "draft",
123
        //                 "link" => "/browse/jobs/00/",
124
        //                 "title" => "Back-end Developer",
125
        //                 "department" => "Treasury Board of Canada Secretariat",
126
        //                 "city" => "Ottawa",
127
        //                 "province" => "Ontario",
128
        //                 "salary" => "80,000 - 120,000",
129
        //                 "duration" => "1 Year",
130
        //                 "remote" => "Allowed",
131
        //                 "telework" => "Allowed",
132
        //                 "time_flexibility" => "Allowed",
133
        //                 "end_date" => "2018-04-09",
134
        //                 "days_remaining" => "12",
135
        //                 "applicants" => "2",
136
        //                 "reference_id" => "14234",
137
        //                 "start" => "January 3rd, 2019",
138
        //                 "language" => "English Essential",
139
        //                 "security" => "Top Secret",
140
        //                 "classification" => "CS3",
141
        //                 "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
142
        //                 "work" => [
143
        //                     "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
144
        //                     "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
145
        //                     "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
146
        //                 ],
147
        //                 "criteria" => [
148
        //                     "essential" => [
149
        //                         "00" => "Criteria 01",
150
        //                         "01" => "Criteria 02",
151
        //                         "02" => "Criteria 03"
152
        //                     ],
153
        //                     "asset" => [
154
        //                         "00" => "Criteria 01",
155
        //                         "01" => "Criteria 02",
156
        //                         "02" => "Criteria 03"
157
        //                     ]
158
        //                 ],
159
        //                 "extras" => [
160
        //                     "00" => [
161
        //                         "title" => "What You Need for Security Clearance",
162
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
163
        //                     ],
164
        //                     "01" => [
165
        //                         "title" => "The Application Process",
166
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
167
        //                     ],
168
        //                     "02" => [
169
        //                         "title" => "Other Paperwork & Preparation",
170
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
171
        //                     ]
172
        //                 ]
173
        //             ],
174
        //             "02" => [
175
        //                 "status" => "active",
176
        //                 "link" => "/browse/jobs/00/",
177
        //                 "title" => "UX Designer",
178
        //                 "department" => "Treasury Board of Canada Secretariat",
179
        //                 "city" => "Ottawa",
180
        //                 "province" => "Ontario",
181
        //                 "salary" => "80,000 - 120,000",
182
        //                 "duration" => "1 Year",
183
        //                 "remote" => "Allowed",
184
        //                 "telework" => "Allowed",
185
        //                 "time_flexibility" => "Allowed",
186
        //                 "end_date" => "2018-04-09",
187
        //                 "days_remaining" => "12",
188
        //                 "applicants" => "2",
189
        //                 "reference_id" => "14234",
190
        //                 "start" => "January 3rd, 2019",
191
        //                 "language" => "English Essential",
192
        //                 "security" => "Top Secret",
193
        //                 "classification" => "CS3",
194
        //                 "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
195
        //                 "work" => [
196
        //                     "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
197
        //                     "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
198
        //                     "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
199
        //                 ],
200
        //                 "criteria" => [
201
        //                     "essential" => [
202
        //                         "00" => "Criteria 01",
203
        //                         "01" => "Criteria 02",
204
        //                         "02" => "Criteria 03"
205
        //                     ],
206
        //                     "asset" => [
207
        //                         "00" => "Criteria 01",
208
        //                         "01" => "Criteria 02",
209
        //                         "02" => "Criteria 03"
210
        //                     ]
211
        //                 ],
212
        //                 "extras" => [
213
        //                     "00" => [
214
        //                         "title" => "What You Need for Security Clearance",
215
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
216
        //                     ],
217
        //                     "01" => [
218
        //                         "title" => "The Application Process",
219
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
220
        //                     ],
221
        //                     "02" => [
222
        //                         "title" => "Other Paperwork & Preparation",
223
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
224
        //                     ]
225
        //                 ],
226
        //                 "applicants" => [
227
        //                     "00" => [
228
        //                         "name" => "Jake McMahon",
229
        //                         "link" => "http://google.com",
230
        //                         "application_link" => "http://google.com"
231
        //                     ],
232
        //                     "01" => [
233
        //                         "name" => "Jake McMahon",
234
        //                         "link" => "http://google.com",
235
        //                         "application_link" => "http://google.com"
236
        //                     ],
237
        //                     "02" => [
238
        //                         "name" => "Jake McMahon",
239
        //                         "link" => "http://google.com",
240
        //                         "application_link" => "http://google.com"
241
        //                     ],
242
        //                     "03" => [
243
        //                         "name" => "Jake McMahon",
244
        //                         "link" => "http://google.com",
245
        //                         "application_link" => "http://google.com"
246
        //                     ],
247
        //                     "04" => [
248
        //                         "name" => "Jake McMahon",
249
        //                         "link" => "http://google.com",
250
        //                         "application_link" => "http://google.com"
251
        //                     ]
252
        //                 ]
253
        //             ],
254
        //             "03" => [
255
        //                 "status" => "active",
256
        //                 "link" => "/browse/jobs/00/",
257
        //                 "title" => "Front-end Developer",
258
        //                 "department" => "Treasury Board of Canada Secretariat",
259
        //                 "city" => "Ottawa",
260
        //                 "province" => "Ontario",
261
        //                 "salary" => "80,000 - 120,000",
262
        //                 "duration" => "1 Year",
263
        //                 "remote" => "Allowed",
264
        //                 "telework" => "Allowed",
265
        //                 "time_flexibility" => "Allowed",
266
        //                 "end_date" => "2018-04-09",
267
        //                 "days_remaining" => "12",
268
        //                 "applicants" => "2",
269
        //                 "reference_id" => "14234",
270
        //                 "start" => "January 3rd, 2019",
271
        //                 "language" => "English Essential",
272
        //                 "security" => "Top Secret",
273
        //                 "classification" => "CS3",
274
        //                 "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
275
        //                 "work" => [
276
        //                     "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
277
        //                     "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
278
        //                     "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
279
        //                 ],
280
        //                 "criteria" => [
281
        //                     "essential" => [
282
        //                         "00" => "Criteria 01",
283
        //                         "01" => "Criteria 02",
284
        //                         "02" => "Criteria 03"
285
        //                     ],
286
        //                     "asset" => [
287
        //                         "00" => "Criteria 01",
288
        //                         "01" => "Criteria 02",
289
        //                         "02" => "Criteria 03"
290
        //                     ]
291
        //                 ],
292
        //                 "extras" => [
293
        //                     "00" => [
294
        //                         "title" => "What You Need for Security Clearance",
295
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
296
        //                     ],
297
        //                     "01" => [
298
        //                         "title" => "The Application Process",
299
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
300
        //                     ],
301
        //                     "02" => [
302
        //                         "title" => "Other Paperwork & Preparation",
303
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
304
        //                     ]
305
        //                 ],
306
        //                 "applicants" => [
307
        //                     "00" => [
308
        //                         "name" => "Jake McMahon",
309
        //                         "link" => "http://google.com",
310
        //                         "application_link" => "http://google.com"
311
        //                     ],
312
        //                     "01" => [
313
        //                         "name" => "Jake McMahon",
314
        //                         "link" => "http://google.com",
315
        //                         "application_link" => "http://google.com"
316
        //                     ],
317
        //                     "02" => [
318
        //                         "name" => "Jake McMahon",
319
        //                         "link" => "http://google.com",
320
        //                         "application_link" => "http://google.com"
321
        //                     ],
322
        //                     "03" => [
323
        //                         "name" => "Jake McMahon",
324
        //                         "link" => "http://google.com",
325
        //                         "application_link" => "http://google.com"
326
        //                     ],
327
        //                     "04" => [
328
        //                         "name" => "Jake McMahon",
329
        //                         "link" => "http://google.com",
330
        //                         "application_link" => "http://google.com"
331
        //                     ]
332
        //                 ]
333
        //             ],
334
        //             "04" => [
335
        //                 "status" => "closed",
336
        //                 "link" => "/browse/jobs/00/",
337
        //                 "title" => "Front-end Developer",
338
        //                 "department" => "Treasury Board of Canada Secretariat",
339
        //                 "city" => "Ottawa",
340
        //                 "province" => "Ontario",
341
        //                 "salary" => "80,000 - 120,000",
342
        //                 "duration" => "1 Year",
343
        //                 "remote" => "Allowed",
344
        //                 "telework" => "Allowed",
345
        //                 "time_flexibility" => "Allowed",
346
        //                 "end_date" => "2018-04-09",
347
        //                 "days_remaining" => "12",
348
        //                 "applicants" => "2",
349
        //                 "reference_id" => "14234",
350
        //                 "start" => "January 3rd, 2019",
351
        //                 "language" => "English Essential",
352
        //                 "security" => "Top Secret",
353
        //                 "classification" => "CS3",
354
        //                 "impact" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat. Sed quis laoreet tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer fringilla at ligula id porttitor. Nullam ac viverra velit, et rhoncus tellus. Praesent in lacus magna. Duis ut vulputate ipsum. In ut ornare elit. Donec id massa felis. Nam at ullamcorper risus. Vestibulum vitae aliquet ex, et ornare libero. Pellentesque sit amet vehicula neque. Donec auctor a erat posuere vehicula.",
355
        //                 "work" => [
356
        //                     "00" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
357
        //                     "01" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat.",
358
        //                     "02" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam porttitor magna et ante ornare faucibus. Quisque ligula enim, finibus vel velit quis, aliquam cursus nunc. Fusce quis urna ut dolor pharetra bibendum. Aliquam erat volutpat."
359
        //                 ],
360
        //                 "criteria" => [
361
        //                     "essential" => [
362
        //                         "00" => "Criteria 01",
363
        //                         "01" => "Criteria 02",
364
        //                         "02" => "Criteria 03"
365
        //                     ],
366
        //                     "asset" => [
367
        //                         "00" => "Criteria 01",
368
        //                         "01" => "Criteria 02",
369
        //                         "02" => "Criteria 03"
370
        //                     ]
371
        //                 ],
372
        //                 "extras" => [
373
        //                     "00" => [
374
        //                         "title" => "What You Need for Security Clearance",
375
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
376
        //                     ],
377
        //                     "01" => [
378
        //                         "title" => "The Application Process",
379
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
380
        //                     ],
381
        //                     "02" => [
382
        //                         "title" => "Other Paperwork & Preparation",
383
        //                         "copy" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent dapibus, purus a congue bibendum, nibh quam convallis leo, a pharetra dui ante nec magna. Proin elementum lacus venenatis nulla luctus, sed porttitor quam ullamcorper. Proin in facilisis sapien, in ullamcorper orci."
384
        //                     ]
385
        //                 ]
386
        //             ]
387
        //         ]
388
        //     ]
389
        // ]);
390
    }
391
392
    /**
393
     * Display the specified job poster.
394
     *
395
     * @param  Request  $request
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 15 spaces after parameter type; 2 found
Loading history...
396
     * @param  \App\Models\JobPoster  $jobPoster
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
Coding Style introduced by
Expected 1 spaces after parameter type; 2 found
Loading history...
397
     * @return \Illuminate\Http\Response
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
398
     */
399
    public function show(Request $request, JobPoster $jobPoster)
400
    {
401
        //TODO: Improve workplace photos, and reference them in template direction from WorkEnvironment model
402
        $workplacePhotos = [];
403
        foreach($jobPoster->manager->work_environment->workplace_photo_captions as $photoCaption) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
404
            $workplacePhotos[] = [
405
                'description' => $photoCaption->description,
406
                'url' => '/images/user.png'
407
            ];
408
        }
409
410
        //TODO: replace route('manager.show',manager.id) in templates with link using slug
411
412
        $criteria = [
413
            'essential' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
414
                return $value->criteria_type->name == 'essential';
415
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
416
            'asset' => $jobPoster->criteria->filter(function($value, $key) {
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
417
                return $value->criteria_type->name == 'asset';
418
            }),
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
419
        ];
420
        Debugbar::info(Criteria::all());
421
        return view('applicant/job_post', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('applicant/j...:get('common/skills'))) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
422
            'job_post' =>Lang::get('applicant/job_post'),
423
            'manager' => $jobPoster->manager,
424
            'manager_profile_photo_url' => '/images/user.png', //TODO get real photo
425
            'team_culture' => $jobPoster->manager->team_culture,
426
            'work_environment' => $jobPoster->manager->work_environment,
427
            'workplace_photos' => $workplacePhotos,
428
            'job' => $jobPoster,
429
            'criteria' => $criteria,
430
            'skill_template' => Lang::get('common/skills'),
431
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
432
    }
433
434
    /**
435
     * Display the form for creating a new Job Poster
436
     * @param  Request $request [description]
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
437
     * @return \Illuminate\Http\Response           A view
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
438
     */
439
    public function create(Request $request) {
440
        $manager = $request->user() ? $request->user()->manager : null;
441
442
        //No job details exist yet because we're creating a new one
443
        $job = [];
444
445
        return view('manager/job_create', [
1 ignored issue
show
Bug Best Practice introduced by
The expression return view('manager/job...:get('common/skills'))) returns the type Illuminate\View\View which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
446
            'job_create' => Lang::get('manager/job_create'),
447
            'manager' => $manager,
448
            'provinces' => Province::all(),
449
            'departments' => Department::all(),
450
            'language_requirments' => LanguageRequirement::all(),
451
            'security_clearances' => SecurityClearance::all(),
452
            'job' => $job,
453
            'form_action_url' => route('manager.jobs.store'),
454
            'skills' => Skill::all(),
455
            'skill_levels' => SkillLevel::all(),
456
            'skill_template' => Lang::get('common/skills'),
457
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
458
    }
459
460
    /**
461
     * Create a new resource in storage
462
     * @param  Request $request
0 ignored issues
show
Coding Style introduced by
There must be exactly one blank line before the tags in a doc comment
Loading history...
Coding Style introduced by
Missing parameter comment
Loading history...
463
     * @return \Illuminate\Http\Response           A redirect
0 ignored issues
show
Coding Style introduced by
Tag cannot be grouped with parameter tags in a doc comment
Loading history...
464
     */
465
    public function store(Request $request) {
466
467
        $input = $request->input();
468
469
        $job = new JobPoster();
470
        $job->manager_id = $request->user()->manager->id;
471
        $job->published = ($input['submit'] == 'publish');
472
        $job->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
473
            'job_term_id' => JobTerm::where('name', 'month')->firstOrFail()->id,
474
            'term_qty' => $input['term_qty'],
475
            'open_date_time' => new Date($input['open_date_time']),
476
            'close_date_time' => new Date($input['close_date_time']),
477
            'start_date_time' => new Date($input['start_date_time']),
478
            'department_id' => $input['department'],
479
            'province_id' => $input['province'],
480
            'salary_min' => $input['salary_min'],
481
            'salary_max' => $input['salary_max'],
482
            'noc' => $input['noc'],
483
            'classification' => $input['classification'],
484
            'security_clearance_id' => $input['security_clearance'],
485
            'language_requirement_id' => $input['language_requirement'],
486
            'en' => [
487
                'city' => $input['city'],
488
                'title' => $input['title']['en'],
489
                'impact' => $input['impact']['en'],
490
                'branch' => $input['branch']['en'],
491
                'division' => $input['division']['en'],
492
                'education' => $input['education']['en'],
493
            ],
494
            'fr' => [
495
                'city' => $input['city'],
496
                'title' => $input['title']['fr'],
497
                'impact' => $input['impact']['fr'],
498
                'branch' => $input['branch']['fr'],
499
                'division' => $input['division']['fr'],
500
                'education' => $input['education']['fr'],
501
            ],
502
        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
503
        $job->save();
504
505
        if (isset($input['task'])) {
506
            foreach($input['task'] as $task) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
507
                $jobPosterTask = new JobPosterKeyTask();
508
                $jobPosterTask->job_poster_id =  $job->id;
509
                $jobPosterTask->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
510
                    'en' => [
511
                        'description' => $task['en']
512
                    ],
513
                    'fr' => [
514
                        'description' => $task['fr']
515
                    ]
516
                ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
517
                $jobPosterTask->save();
518
            }
519
        }
520
521
        if (isset($input['question'])) {
522
            foreach($input['question'] as $question) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
523
                $jobQuestion = new JobPosterQuestion();
524
                $jobQuestion->job_poster_id = $job->id;
525
                $jobQuestion->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
526
                    'en'=> [
527
                        'question' => $question['question']['en'],
528
                        'description' => $question['description']['en']
529
                    ],
530
                    'fr'=> [
531
                        'question' => $question['question']['fr'],
532
                        'description' => $question['description']['fr']
533
                    ]
534
                ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
535
                $jobQuestion->save();
536
            }
537
        }
538
539
        $criteria = $input['criteria'];
540
541
        //Save new criteria
542
        if (isset($criteria['new'])) {
543
            foreach($criteria['new'] as $criteriaType => $criteriaTypeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
544
                foreach($criteriaTypeInput as $skillType => $skillTypeInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
545
                    foreach($skillTypeInput as $criteriaInput) {
0 ignored issues
show
Coding Style introduced by
Expected "foreach (...) {\n"; found "foreach(...) {\n"
Loading history...
546
                        $criteria = new Criteria();
547
                        $criteria->job_poster_id = $job->id;
548
                        $criteria->fill([
0 ignored issues
show
Coding Style introduced by
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
549
                            'criteria_type_id' => CriteriaType::where('name', $criteriaType)->firstOrFail()->id,
550
                            'skill_id' => $criteriaInput['skill_id'],
551
                            'skill_level_id' => $criteriaInput['skill_level_id'],
552
                            'en' => [
553
                                'description' => $criteriaInput['description']['en'],
554
                            ],
555
                            'fr' => [
556
                                'description' => $criteriaInput['description']['fr'],
557
                            ],
558
                        ]);
0 ignored issues
show
Coding Style introduced by
For multi-line function calls, the closing parenthesis should be on a new line.

If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
); // Closing parenthesis on a new line.
Loading history...
559
                        $criteria->save();
560
                    }
561
                }
562
            }
563
        }
564
565
        return redirect( route('manager.jobs.index') );
1 ignored issue
show
Bug Best Practice introduced by
The expression return redirect(route('manager.jobs.index')) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type Illuminate\Http\Response.
Loading history...
566
    }
567
}
568