Passed
Push — task/comment-model ( 01686c )
by Yonathan
13:23
created
app/Models/Comment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
 
29 29
     public function job_poster() // phpcs:ignore
30 30
     {
31
-        return $this->belongsTo(\App\Models\JobPoster::class);
31
+        return $this->belongsTo (\App\Models\JobPoster::class);
32 32
     }
33 33
 
34 34
     public function user() // phpcs:ignore
35 35
     {
36
-        return $this->belongsTo(\App\Models\User::class);
36
+        return $this->belongsTo (\App\Models\User::class);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.
app/Models/JobPoster.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -273,87 +273,87 @@  discard block
 block discarded – undo
273 273
     // @codeCoverageIgnoreStart
274 274
     public function department() // phpcs:ignore
275 275
     {
276
-        return $this->belongsTo(\App\Models\Lookup\Department::class);
276
+        return $this->belongsTo (\App\Models\Lookup\Department::class);
277 277
     }
278 278
 
279 279
     public function job_term() // phpcs:ignore
280 280
     {
281
-        return $this->belongsTo(\App\Models\Lookup\JobTerm::class);
281
+        return $this->belongsTo (\App\Models\Lookup\JobTerm::class);
282 282
     }
283 283
 
284 284
     public function language_requirement() // phpcs:ignore
285 285
     {
286
-        return $this->belongsTo(\App\Models\Lookup\LanguageRequirement::class);
286
+        return $this->belongsTo (\App\Models\Lookup\LanguageRequirement::class);
287 287
     }
288 288
 
289 289
     public function manager() // phpcs:ignore
290 290
     {
291
-        return $this->belongsTo(\App\Models\Manager::class);
291
+        return $this->belongsTo (\App\Models\Manager::class);
292 292
     }
293 293
 
294 294
     public function province() // phpcs:ignore
295 295
     {
296
-        return $this->belongsTo(\App\Models\Lookup\Province::class);
296
+        return $this->belongsTo (\App\Models\Lookup\Province::class);
297 297
     }
298 298
 
299 299
     public function security_clearance() // phpcs:ignore
300 300
     {
301
-        return $this->belongsTo(\App\Models\Lookup\SecurityClearance::class);
301
+        return $this->belongsTo (\App\Models\Lookup\SecurityClearance::class);
302 302
     }
303 303
 
304 304
     public function criteria() // phpcs:ignore
305 305
     {
306
-        return $this->hasMany(\App\Models\Criteria::class);
306
+        return $this->hasMany (\App\Models\Criteria::class);
307 307
     }
308 308
 
309 309
     public function job_applications() // phpcs:ignore
310 310
     {
311
-        return $this->hasMany(\App\Models\JobApplication::class);
311
+        return $this->hasMany (\App\Models\JobApplication::class);
312 312
     }
313 313
 
314 314
     public function job_poster_key_tasks() // phpcs:ignore
315 315
     {
316
-        return $this->hasMany(\App\Models\JobPosterKeyTask::class);
316
+        return $this->hasMany (\App\Models\JobPosterKeyTask::class);
317 317
     }
318 318
 
319 319
     public function job_poster_questions() // phpcs:ignore
320 320
     {
321
-        return $this->hasMany(\App\Models\JobPosterQuestion::class);
321
+        return $this->hasMany (\App\Models\JobPosterQuestion::class);
322 322
     }
323 323
 
324 324
     public function job_poster_translations() // phpcs:ignore
325 325
     {
326
-        return $this->hasMany(\App\Models\JobPosterTranslation::class);
326
+        return $this->hasMany (\App\Models\JobPosterTranslation::class);
327 327
     }
328 328
 
329 329
     public function telework_allowed_frequency() // phpcs:ignore
330 330
     {
331
-        return $this->belongsTo(\App\Models\Lookup\Frequency::class);
331
+        return $this->belongsTo (\App\Models\Lookup\Frequency::class);
332 332
     }
333 333
 
334 334
     public function flexible_hours_frequency() // phpcs:ignore
335 335
     {
336
-        return $this->belongsTo(\App\Models\Lookup\Frequency::class);
336
+        return $this->belongsTo (\App\Models\Lookup\Frequency::class);
337 337
     }
338 338
 
339 339
     public function travel_requirement() // phpcs:ignore
340 340
     {
341
-        return $this->belongsTo(\App\Models\Lookup\TravelRequirement::class);
341
+        return $this->belongsTo (\App\Models\Lookup\TravelRequirement::class);
342 342
     }
343 343
 
344 344
     public function overtime_requirement() // phpcs:ignore
345 345
     {
346
-        return $this->belongsTo(\App\Models\Lookup\OvertimeRequirement::class);
346
+        return $this->belongsTo (\App\Models\Lookup\OvertimeRequirement::class);
347 347
     }
348 348
 
349 349
     public function classification() // phpcs:ignore
350 350
     {
351
-        return $this->belongsTo(\App\Models\Classification::class);
351
+        return $this->belongsTo (\App\Models\Classification::class);
352 352
     }
353 353
 
354 354
     public function comments() // phpcs:ignore
355 355
     {
356
-        return $this->hasMany(\App\Models\Comment::class);
356
+        return $this->hasMany (\App\Models\Comment::class);
357 357
     }
358 358
     // @codeCoverageIgnoreEnd
359 359
     /* Artificial Relations */
@@ -366,8 +366,8 @@  discard block
 block discarded – undo
366 366
      */
367 367
     public function submitted_applications() // phpcs:ignore
368 368
     {
369
-        return $this->hasMany(\App\Models\JobApplication::class)->whereDoesntHave('application_status', function ($query): void {
370
-            $query->where('name', 'draft');
369
+        return $this->hasMany (\App\Models\JobApplication::class)->whereDoesntHave ('application_status', function ($query): void {
370
+            $query->where ('name', 'draft');
371 371
         });
372 372
     }
373 373
 
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
      */
387 387
     public function resolveRouteBinding($value) // phpcs:ignore
388 388
     {
389
-        return $this->withCount('submitted_applications')->where('id', $value)->first() ?? abort(404);
389
+        return $this->withCount ('submitted_applications')->where ('id', $value)->first () ?? abort (404);
390 390
     }
391 391
 
392 392
     /**
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
     public function setPublishedAttribute($value): void
401 401
     {
402 402
         if ($value) {
403
-            $this->attributes['published_at'] = new Date();
403
+            $this->attributes['published_at'] = new Date ();
404 404
         } else {
405 405
             $this->attributes['published_at'] = null;
406 406
         }
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
     public function submitted_applications_count() //phpcs:ignore
416 416
     {
417
-        return $this->submitted_applications()->count();
417
+        return $this->submitted_applications ()->count ();
418 418
     }
419 419
 
420 420
     /**
@@ -424,15 +424,15 @@  discard block
 block discarded – undo
424 424
      */
425 425
     public function applyBy(): array
426 426
     {
427
-        $localCloseDate = new Date($this->close_date_time); // This initializes the date object in UTC time.
428
-        $localCloseDate->setTimezone(new \DateTimeZone(self::TIMEZONE)); // Then set the time zone for display.
427
+        $localCloseDate = new Date ($this->close_date_time); // This initializes the date object in UTC time.
428
+        $localCloseDate->setTimezone (new \DateTimeZone (self::TIMEZONE)); // Then set the time zone for display.
429 429
         $displayDate = [
430
-            'date' => $localCloseDate->format(self::DATE_FORMAT[App::getLocale()]),
431
-            'time' => $localCloseDate->format(self::TIME_FORMAT[App::getLocale()])
430
+            'date' => $localCloseDate->format (self::DATE_FORMAT[App::getLocale ()]),
431
+            'time' => $localCloseDate->format (self::TIME_FORMAT[App::getLocale ()])
432 432
         ];
433 433
 
434
-        if (App::isLocale('fr')) {
435
-            $displayDate['time'] = str_replace(['EST', 'EDT'], ['HNE', 'HAE'], $displayDate['time']);
434
+        if (App::isLocale ('fr')) {
435
+            $displayDate['time'] = str_replace (['EST', 'EDT'], ['HNE', 'HAE'], $displayDate['time']);
436 436
         }
437 437
 
438 438
         return $displayDate;
@@ -446,7 +446,7 @@  discard block
 block discarded – undo
446 446
      */
447 447
     public function displayStatus(): string
448 448
     {
449
-        return $this->isOpen() ? 'Open' : 'Closed';
449
+        return $this->isOpen () ? 'Open' : 'Closed';
450 450
     }
451 451
 
452 452
     /**
@@ -459,8 +459,8 @@  discard block
 block discarded – undo
459 459
         return $this->published
460 460
             && $this->open_date_time !== null
461 461
             && $this->close_date_time !== null
462
-            && $this->open_date_time->isPast()
463
-            && $this->close_date_time->isFuture();
462
+            && $this->open_date_time->isPast ()
463
+            && $this->close_date_time->isFuture ();
464 464
     }
465 465
 
466 466
     /**
@@ -473,8 +473,8 @@  discard block
 block discarded – undo
473 473
         return $this->published
474 474
             && $this->open_date_time !== null
475 475
             && $this->close_date_time !== null
476
-            && $this->open_date_time->isPast()
477
-            && $this->close_date_time->isPast();
476
+            && $this->open_date_time->isPast ()
477
+            && $this->close_date_time->isPast ();
478 478
     }
479 479
 
480 480
     /**
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
      */
485 485
     public function timeRemaining(): string
486 486
     {
487
-        $interval = $this->close_date_time->diff(Date::now());
487
+        $interval = $this->close_date_time->diff (Date::now ());
488 488
 
489 489
         $d = $interval->d;
490 490
         $h = $interval->h;
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
 
508 508
         $key = "common/time.$unit";
509 509
 
510
-        return Lang::choice($key, $count);
510
+        return Lang::choice ($key, $count);
511 511
     }
512 512
 
513 513
     /**
@@ -519,9 +519,9 @@  discard block
 block discarded – undo
519 519
     public function status(): string
520 520
     {
521 521
         $status = 'draft';
522
-        if ($this->isOpen()) {
522
+        if ($this->isOpen ()) {
523 523
             $status = 'published';
524
-        } elseif ($this->isClosed()) {
524
+        } elseif ($this->isClosed ()) {
525 525
             $status = 'closed';
526 526
         } elseif ($this->review_requested_at !== null) {
527 527
             $status = 'submitted';
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
     public function getClassificationMessageAttribute()
556 556
     {
557 557
         if ($this->classification_id !== null && $this->classification_level !== null) {
558
-            return $this->classification->key . '-0' . $this->classification_level;
558
+            return $this->classification->key.'-0'.$this->classification_level;
559 559
         }
560 560
         return null;
561 561
     }
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
      */
569 569
     public function toApiArray(): array
570 570
     {
571
-        $jobWithTranslations = array_merge($this->toArray(), $this->getTranslationsArray());
571
+        $jobWithTranslations = array_merge ($this->toArray (), $this->getTranslationsArray ());
572 572
         return $jobWithTranslations;
573 573
     }
574 574
 }
Please login to merge, or discard this patch.
database/seeds/DatabaseSeeder.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      */
12 12
     public function run()
13 13
     {
14
-        $this->call([
14
+        $this->call ([
15 15
             DevSeeder::class,
16 16
             SkillClassificationSeeder::class,
17 17
             CommentSeeder::class
Please login to merge, or discard this patch.
database/seeds/CommentSeeder.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@
 block discarded – undo
13 13
      */
14 14
     public function run()
15 15
     {
16
-        $job_posters = JobPoster::all();
16
+        $job_posters = JobPoster::all ();
17 17
 
18
-        $job_posters->each(function ($job_poster) {
19
-            $job_poster->comments()->save(factory(App\Models\Comment::class)->make());
18
+        $job_posters->each (function ($job_poster){
19
+            $job_poster->comments ()->save (factory (App\Models\Comment::class)->make ());
20 20
         });
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
database/factories/CommentFactory.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
 use App\Models\User;
9 9
 use Faker\Generator as Faker;
10 10
 
11
-$factory->define(Comment::class, function (Faker $faker) {
11
+$factory->define (Comment::class, function (Faker $faker){
12 12
     return [
13
-        'job_poster_id' => function () {
14
-            return factory(JobPoster::class)->create()->id;
13
+        'job_poster_id' => function (){
14
+            return factory (JobPoster::class)->create ()->id;
15 15
         },
16
-        'user_id' => function () {
17
-            return factory(User::class)->create()->id;
16
+        'user_id' => function (){
17
+            return factory (User::class)->create ()->id;
18 18
         },
19
-        'comment' => $faker->sentence(),
20
-        'location' => $faker->word(),
21
-        'type_id' => CommentType::inRandomOrder()->first()->id,
19
+        'comment' => $faker->sentence (),
20
+        'location' => $faker->word (),
21
+        'type_id' => CommentType::inRandomOrder ()->first ()->id,
22 22
     ];
23 23
 });
Please login to merge, or discard this patch.