@@ -21,105 +21,105 @@ |
||
21 | 21 | | |
22 | 22 | */ |
23 | 23 | |
24 | -$faker_fr = Faker\Factory::create('fr'); |
|
24 | +$faker_fr = Faker\Factory::create ('fr'); |
|
25 | 25 | |
26 | -$factory->define(User::class, function (Faker\Generator $faker) { |
|
26 | +$factory->define (User::class, function (Faker\Generator $faker){ |
|
27 | 27 | static $password; |
28 | 28 | |
29 | 29 | return [ |
30 | - 'first_name' => $faker->firstName(), |
|
31 | - 'last_name' => $faker->lastName(), |
|
32 | - 'email' => $faker->unique()->safeEmail(), |
|
33 | - 'password' => $password ? : $password = Hash::make('password'), |
|
30 | + 'first_name' => $faker->firstName (), |
|
31 | + 'last_name' => $faker->lastName (), |
|
32 | + 'email' => $faker->unique ()->safeEmail (), |
|
33 | + 'password' => $password ?: $password = Hash::make ('password'), |
|
34 | 34 | 'is_confirmed' => 1, |
35 | - 'user_role_id' => UserRole::where('name', 'basic')->first()->id, // Users should default to basic user role. |
|
36 | - 'remember_token' => str_random(10), |
|
37 | - 'is_priority' => $faker->boolean(10), // 10% chance of true |
|
35 | + 'user_role_id' => UserRole::where ('name', 'basic')->first ()->id, // Users should default to basic user role. |
|
36 | + 'remember_token' => str_random (10), |
|
37 | + 'is_priority' => $faker->boolean (10), // 10% chance of true |
|
38 | 38 | ]; |
39 | 39 | }); |
40 | 40 | |
41 | -$factory->state(User::class, 'upgradedManager', function (Faker\Generator $faker) { |
|
41 | +$factory->state (User::class, 'upgradedManager', function (Faker\Generator $faker){ |
|
42 | 42 | return [ |
43 | - 'user_role_id' => UserRole::where('name', 'upgradedManager')->first()->id, |
|
44 | - 'gov_email' => $faker->unique()->safeEmail(), |
|
43 | + 'user_role_id' => UserRole::where ('name', 'upgradedManager')->first ()->id, |
|
44 | + 'gov_email' => $faker->unique ()->safeEmail (), |
|
45 | 45 | ]; |
46 | 46 | }); |
47 | 47 | |
48 | -$factory->state(User::class, 'applicant', [ |
|
49 | - 'user_role_id' => UserRole::where('name', 'basic')->first()->id |
|
48 | +$factory->state (User::class, 'applicant', [ |
|
49 | + 'user_role_id' => UserRole::where ('name', 'basic')->first ()->id |
|
50 | 50 | ]); |
51 | 51 | |
52 | -$factory->state(User::class, 'admin', [ |
|
53 | - 'user_role_id' => UserRole::where('name', 'admin')->first()->id |
|
52 | +$factory->state (User::class, 'admin', [ |
|
53 | + 'user_role_id' => UserRole::where ('name', 'admin')->first ()->id |
|
54 | 54 | ]); |
55 | 55 | |
56 | -$factory->state(User::class, 'priority', [ |
|
56 | +$factory->state (User::class, 'priority', [ |
|
57 | 57 | 'is_priority' => true |
58 | 58 | ]); |
59 | 59 | |
60 | -$factory->define(Applicant::class, function (Faker\Generator $faker) { |
|
60 | +$factory->define (Applicant::class, function (Faker\Generator $faker){ |
|
61 | 61 | return [ |
62 | - 'twitter_username' => $faker->firstName(), |
|
62 | + 'twitter_username' => $faker->firstName (), |
|
63 | 63 | 'linkedin_url' => null, |
64 | - 'tagline' => $faker->paragraph(), |
|
65 | - 'personal_website' => $faker->url(), |
|
64 | + 'tagline' => $faker->paragraph (), |
|
65 | + 'personal_website' => $faker->url (), |
|
66 | 66 | 'is_snapshot' => false, |
67 | - 'user_id' => function () { |
|
68 | - return factory(User::class)->states('applicant')->create()->id; |
|
67 | + 'user_id' => function (){ |
|
68 | + return factory (User::class)->states ('applicant')->create ()->id; |
|
69 | 69 | }, |
70 | 70 | ]; |
71 | 71 | }); |
72 | 72 | |
73 | -$factory->define(Manager::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
73 | +$factory->define (Manager::class, function (Faker\Generator $faker) use ($faker_fr) { |
|
74 | 74 | return [ |
75 | - 'twitter_username' => $faker->firstName(), |
|
75 | + 'twitter_username' => $faker->firstName (), |
|
76 | 76 | 'linkedin_url' => null, |
77 | - 'department_id' => Department::inRandomOrder()->first()->id, |
|
78 | - 'work_review_frequency_id' => Frequency::inRandomOrder()->first()->id, |
|
79 | - 'stay_late_frequency_id' => Frequency::inRandomOrder()->first()->id, |
|
80 | - 'engage_team_frequency_id' => Frequency::inRandomOrder()->first()->id, |
|
81 | - 'development_opportunity_frequency_id' => Frequency::inRandomOrder()->first()->id, |
|
82 | - 'refuse_low_value_work_frequency_id' => Frequency::inRandomOrder()->first()->id, |
|
83 | - 'years_experience' => $faker->numberBetween(2, 25), |
|
77 | + 'department_id' => Department::inRandomOrder ()->first ()->id, |
|
78 | + 'work_review_frequency_id' => Frequency::inRandomOrder ()->first ()->id, |
|
79 | + 'stay_late_frequency_id' => Frequency::inRandomOrder ()->first ()->id, |
|
80 | + 'engage_team_frequency_id' => Frequency::inRandomOrder ()->first ()->id, |
|
81 | + 'development_opportunity_frequency_id' => Frequency::inRandomOrder ()->first ()->id, |
|
82 | + 'refuse_low_value_work_frequency_id' => Frequency::inRandomOrder ()->first ()->id, |
|
83 | + 'years_experience' => $faker->numberBetween (2, 25), |
|
84 | 84 | 'user_id' => function () use ($faker) { |
85 | - return factory(User::class)->create([ |
|
86 | - 'gov_email' => $faker->unique()->safeEmail(), |
|
85 | + return factory (User::class)->create ([ |
|
86 | + 'gov_email' => $faker->unique ()->safeEmail (), |
|
87 | 87 | ])->id; |
88 | 88 | }, |
89 | - 'about_me:en' => $faker->paragraphs(3, true), |
|
90 | - 'greatest_accomplishment:en' => $faker->paragraphs(3, true), |
|
91 | - 'division:en' => $faker->word(), |
|
92 | - 'position:en' => $faker->word(), |
|
93 | - 'leadership_style:en' => $faker->paragraphs(2, true), |
|
94 | - 'employee_learning:en' => $faker->paragraphs(2, true), |
|
95 | - 'expectations:en' => $faker->paragraphs(2, true), |
|
96 | - 'career_journey:en' => $faker->paragraphs(3, true), |
|
97 | - 'learning_path:en' => $faker->paragraphs(3, true), |
|
98 | - 'education:en' => $faker->paragraphs(3, true), |
|
99 | - 'about_me:fr' => $faker_fr->paragraphs(3, true), |
|
100 | - 'greatest_accomplishment:fr' => $faker_fr->paragraphs(3, true), |
|
101 | - 'division:fr' => $faker_fr->word(), |
|
102 | - 'position:fr' => $faker_fr->word(), |
|
103 | - 'leadership_style:fr' => $faker_fr->paragraphs(2, true), |
|
104 | - 'employee_learning:fr' => $faker_fr->paragraphs(2, true), |
|
105 | - 'expectations:fr' => $faker_fr->paragraphs(2, true), |
|
106 | - 'career_journey:fr' => $faker_fr->paragraphs(3, true), |
|
107 | - 'learning_path:fr' => $faker_fr->paragraphs(3, true), |
|
108 | - 'education:fr' => $faker_fr->paragraphs(3, true), |
|
89 | + 'about_me:en' => $faker->paragraphs (3, true), |
|
90 | + 'greatest_accomplishment:en' => $faker->paragraphs (3, true), |
|
91 | + 'division:en' => $faker->word (), |
|
92 | + 'position:en' => $faker->word (), |
|
93 | + 'leadership_style:en' => $faker->paragraphs (2, true), |
|
94 | + 'employee_learning:en' => $faker->paragraphs (2, true), |
|
95 | + 'expectations:en' => $faker->paragraphs (2, true), |
|
96 | + 'career_journey:en' => $faker->paragraphs (3, true), |
|
97 | + 'learning_path:en' => $faker->paragraphs (3, true), |
|
98 | + 'education:en' => $faker->paragraphs (3, true), |
|
99 | + 'about_me:fr' => $faker_fr->paragraphs (3, true), |
|
100 | + 'greatest_accomplishment:fr' => $faker_fr->paragraphs (3, true), |
|
101 | + 'division:fr' => $faker_fr->word (), |
|
102 | + 'position:fr' => $faker_fr->word (), |
|
103 | + 'leadership_style:fr' => $faker_fr->paragraphs (2, true), |
|
104 | + 'employee_learning:fr' => $faker_fr->paragraphs (2, true), |
|
105 | + 'expectations:fr' => $faker_fr->paragraphs (2, true), |
|
106 | + 'career_journey:fr' => $faker_fr->paragraphs (3, true), |
|
107 | + 'learning_path:fr' => $faker_fr->paragraphs (3, true), |
|
108 | + 'education:fr' => $faker_fr->paragraphs (3, true), |
|
109 | 109 | ]; |
110 | 110 | }); |
111 | 111 | |
112 | -$factory->state(Manager::class, 'upgraded', [ |
|
113 | - 'user_id' => function () { |
|
114 | - return factory(User::class)->state('upgradedManager')->create()->id; |
|
112 | +$factory->state (Manager::class, 'upgraded', [ |
|
113 | + 'user_id' => function (){ |
|
114 | + return factory (User::class)->state ('upgradedManager')->create ()->id; |
|
115 | 115 | }, |
116 | 116 | ]); |
117 | 117 | |
118 | -$factory->afterCreating(Manager::class, function ($manager) : void { |
|
119 | - $manager->team_culture()->save(factory(TeamCulture::class)->create([ |
|
118 | +$factory->afterCreating (Manager::class, function ($manager) : void { |
|
119 | + $manager->team_culture ()->save (factory (TeamCulture::class)->create ([ |
|
120 | 120 | 'manager_id' => $manager->id, |
121 | 121 | ])); |
122 | - $manager->work_environment()->save(factory(WorkEnvironment::class)->create([ |
|
122 | + $manager->work_environment ()->save (factory (WorkEnvironment::class)->create ([ |
|
123 | 123 | 'manager_id' => $manager->id, |
124 | 124 | ])); |
125 | 125 | }); |
@@ -272,82 +272,82 @@ discard block |
||
272 | 272 | // @codeCoverageIgnoreStart |
273 | 273 | public function department() // phpcs:ignore |
274 | 274 | { |
275 | - return $this->belongsTo(\App\Models\Lookup\Department::class); |
|
275 | + return $this->belongsTo (\App\Models\Lookup\Department::class); |
|
276 | 276 | } |
277 | 277 | |
278 | 278 | public function job_term() // phpcs:ignore |
279 | 279 | { |
280 | - return $this->belongsTo(\App\Models\Lookup\JobTerm::class); |
|
280 | + return $this->belongsTo (\App\Models\Lookup\JobTerm::class); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | public function language_requirement() // phpcs:ignore |
284 | 284 | { |
285 | - return $this->belongsTo(\App\Models\Lookup\LanguageRequirement::class); |
|
285 | + return $this->belongsTo (\App\Models\Lookup\LanguageRequirement::class); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | public function manager() // phpcs:ignore |
289 | 289 | { |
290 | - return $this->belongsTo(\App\Models\Manager::class); |
|
290 | + return $this->belongsTo (\App\Models\Manager::class); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | public function province() // phpcs:ignore |
294 | 294 | { |
295 | - return $this->belongsTo(\App\Models\Lookup\Province::class); |
|
295 | + return $this->belongsTo (\App\Models\Lookup\Province::class); |
|
296 | 296 | } |
297 | 297 | |
298 | 298 | public function security_clearance() // phpcs:ignore |
299 | 299 | { |
300 | - return $this->belongsTo(\App\Models\Lookup\SecurityClearance::class); |
|
300 | + return $this->belongsTo (\App\Models\Lookup\SecurityClearance::class); |
|
301 | 301 | } |
302 | 302 | |
303 | 303 | public function criteria() // phpcs:ignore |
304 | 304 | { |
305 | - return $this->hasMany(\App\Models\Criteria::class); |
|
305 | + return $this->hasMany (\App\Models\Criteria::class); |
|
306 | 306 | } |
307 | 307 | |
308 | 308 | public function job_applications() // phpcs:ignore |
309 | 309 | { |
310 | - return $this->hasMany(\App\Models\JobApplication::class); |
|
310 | + return $this->hasMany (\App\Models\JobApplication::class); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | public function job_poster_key_tasks() // phpcs:ignore |
314 | 314 | { |
315 | - return $this->hasMany(\App\Models\JobPosterKeyTask::class); |
|
315 | + return $this->hasMany (\App\Models\JobPosterKeyTask::class); |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | public function job_poster_questions() // phpcs:ignore |
319 | 319 | { |
320 | - return $this->hasMany(\App\Models\JobPosterQuestion::class); |
|
320 | + return $this->hasMany (\App\Models\JobPosterQuestion::class); |
|
321 | 321 | } |
322 | 322 | |
323 | 323 | public function job_poster_translations() // phpcs:ignore |
324 | 324 | { |
325 | - return $this->hasMany(\App\Models\JobPosterTranslation::class); |
|
325 | + return $this->hasMany (\App\Models\JobPosterTranslation::class); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | public function telework_allowed_frequency() // phpcs:ignore |
329 | 329 | { |
330 | - return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
|
330 | + return $this->belongsTo (\App\Models\Lookup\Frequency::class); |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | public function flexible_hours_frequency() // phpcs:ignore |
334 | 334 | { |
335 | - return $this->belongsTo(\App\Models\Lookup\Frequency::class); |
|
335 | + return $this->belongsTo (\App\Models\Lookup\Frequency::class); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | public function travel_requirement() // phpcs:ignore |
339 | 339 | { |
340 | - return $this->belongsTo(\App\Models\Lookup\TravelRequirement::class); |
|
340 | + return $this->belongsTo (\App\Models\Lookup\TravelRequirement::class); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | public function overtime_requirement() // phpcs:ignore |
344 | 344 | { |
345 | - return $this->belongsTo(\App\Models\Lookup\OvertimeRequirement::class); |
|
345 | + return $this->belongsTo (\App\Models\Lookup\OvertimeRequirement::class); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | public function classification() // phpcs:ignore |
349 | 349 | { |
350 | - return $this->belongsTo(\App\Models\Classification::class); |
|
350 | + return $this->belongsTo (\App\Models\Classification::class); |
|
351 | 351 | } |
352 | 352 | // @codeCoverageIgnoreEnd |
353 | 353 | /* Artificial Relations */ |
@@ -360,8 +360,8 @@ discard block |
||
360 | 360 | */ |
361 | 361 | public function submitted_applications() // phpcs:ignore |
362 | 362 | { |
363 | - return $this->hasMany(\App\Models\JobApplication::class)->whereDoesntHave('application_status', function ($query): void { |
|
364 | - $query->where('name', 'draft'); |
|
363 | + return $this->hasMany (\App\Models\JobApplication::class)->whereDoesntHave ('application_status', function ($query): void { |
|
364 | + $query->where ('name', 'draft'); |
|
365 | 365 | }); |
366 | 366 | } |
367 | 367 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | */ |
381 | 381 | public function resolveRouteBinding($value) // phpcs:ignore |
382 | 382 | { |
383 | - return $this->withCount('submitted_applications')->where('id', $value)->first() ?? abort(404); |
|
383 | + return $this->withCount ('submitted_applications')->where ('id', $value)->first () ?? abort (404); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | /** |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | public function setPublishedAttribute($value): void |
395 | 395 | { |
396 | 396 | if ($value) { |
397 | - $this->attributes['published_at'] = new Date(); |
|
397 | + $this->attributes['published_at'] = new Date (); |
|
398 | 398 | } else { |
399 | 399 | $this->attributes['published_at'] = null; |
400 | 400 | } |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | |
409 | 409 | public function submitted_applications_count() //phpcs:ignore |
410 | 410 | { |
411 | - return $this->submitted_applications()->count(); |
|
411 | + return $this->submitted_applications ()->count (); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function applyBy(): array |
420 | 420 | { |
421 | - $localCloseDate = new Date($this->close_date_time); // This initializes the date object in UTC time. |
|
422 | - $localCloseDate->setTimezone(new \DateTimeZone(self::TIMEZONE)); // Then set the time zone for display. |
|
421 | + $localCloseDate = new Date ($this->close_date_time); // This initializes the date object in UTC time. |
|
422 | + $localCloseDate->setTimezone (new \DateTimeZone (self::TIMEZONE)); // Then set the time zone for display. |
|
423 | 423 | $displayDate = [ |
424 | - 'date' => $localCloseDate->format(self::DATE_FORMAT[App::getLocale()]), |
|
425 | - 'time' => $localCloseDate->format(self::TIME_FORMAT[App::getLocale()]) |
|
424 | + 'date' => $localCloseDate->format (self::DATE_FORMAT[App::getLocale ()]), |
|
425 | + 'time' => $localCloseDate->format (self::TIME_FORMAT[App::getLocale ()]) |
|
426 | 426 | ]; |
427 | 427 | |
428 | - if (App::isLocale('fr')) { |
|
429 | - $displayDate['time'] = str_replace(['EST', 'EDT'], ['HNE', 'HAE'], $displayDate['time']); |
|
428 | + if (App::isLocale ('fr')) { |
|
429 | + $displayDate['time'] = str_replace (['EST', 'EDT'], ['HNE', 'HAE'], $displayDate['time']); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | return $displayDate; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | */ |
441 | 441 | public function displayStatus(): string |
442 | 442 | { |
443 | - return $this->isOpen() ? 'Open' : 'Closed'; |
|
443 | + return $this->isOpen () ? 'Open' : 'Closed'; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
@@ -453,8 +453,8 @@ discard block |
||
453 | 453 | return $this->published |
454 | 454 | && $this->open_date_time !== null |
455 | 455 | && $this->close_date_time !== null |
456 | - && $this->open_date_time->isPast() |
|
457 | - && $this->close_date_time->isFuture(); |
|
456 | + && $this->open_date_time->isPast () |
|
457 | + && $this->close_date_time->isFuture (); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | return $this->published |
468 | 468 | && $this->open_date_time !== null |
469 | 469 | && $this->close_date_time !== null |
470 | - && $this->open_date_time->isPast() |
|
471 | - && $this->close_date_time->isPast(); |
|
470 | + && $this->open_date_time->isPast () |
|
471 | + && $this->close_date_time->isPast (); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | */ |
479 | 479 | public function timeRemaining(): string |
480 | 480 | { |
481 | - $interval = $this->close_date_time->diff(Date::now()); |
|
481 | + $interval = $this->close_date_time->diff (Date::now ()); |
|
482 | 482 | |
483 | 483 | $d = $interval->d; |
484 | 484 | $h = $interval->h; |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | |
502 | 502 | $key = "common/time.$unit"; |
503 | 503 | |
504 | - return Lang::choice($key, $count); |
|
504 | + return Lang::choice ($key, $count); |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | /** |
@@ -513,9 +513,9 @@ discard block |
||
513 | 513 | public function status(): string |
514 | 514 | { |
515 | 515 | $status = 'draft'; |
516 | - if ($this->isOpen()) { |
|
516 | + if ($this->isOpen ()) { |
|
517 | 517 | $status = 'published'; |
518 | - } elseif ($this->isClosed()) { |
|
518 | + } elseif ($this->isClosed ()) { |
|
519 | 519 | $status = 'closed'; |
520 | 520 | } elseif ($this->review_requested_at !== null) { |
521 | 521 | $status = 'submitted'; |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | public function getClassificationMessageAttribute() |
550 | 550 | { |
551 | 551 | if ($this->classification_id !== null && $this->classification_level !== null) { |
552 | - return $this->classification->key . '-0' . $this->classification_level; |
|
552 | + return $this->classification->key.'-0'.$this->classification_level; |
|
553 | 553 | } |
554 | 554 | return null; |
555 | 555 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function toApiArray(): array |
564 | 564 | { |
565 | - $jobWithTranslations = array_merge($this->toArray(), $this->getTranslationsArray()); |
|
565 | + $jobWithTranslations = array_merge ($this->toArray (), $this->getTranslationsArray ()); |
|
566 | 566 | return $jobWithTranslations; |
567 | 567 | } |
568 | 568 | } |