@@ -30,8 +30,8 @@ |
||
30 | 30 | 'description' |
31 | 31 | ]; |
32 | 32 | |
33 | - public function job_poster_question() { |
|
34 | - return $this->belongsTo(\App\Models\JobPosterQuestion::class); |
|
33 | + public function job_poster_question () { |
|
34 | + return $this->belongsTo (\App\Models\JobPosterQuestion::class); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | } |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @return Illuminate\Database\Eloquent\Relations\Relation |
37 | 37 | */ |
38 | - public function criterion() // phpcs:ignore |
|
38 | + public function criterion () // phpcs:ignore |
|
39 | 39 | { |
40 | - return $this->belongsTo(Criteria::class, 'criterion_id'); |
|
40 | + return $this->belongsTo (Criteria::class, 'criterion_id'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -45,8 +45,8 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @return Illuminate\Database\Eloquent\Relations\Relation |
47 | 47 | */ |
48 | - public function assessment_type() // phpcs:ignore |
|
48 | + public function assessment_type () // phpcs:ignore |
|
49 | 49 | { |
50 | - return $this->belongsTo(AssessmentType::class); |
|
50 | + return $this->belongsTo (AssessmentType::class); |
|
51 | 51 | } |
52 | 52 | } |
@@ -45,13 +45,13 @@ |
||
45 | 45 | 'gc_directory_url' |
46 | 46 | ]; |
47 | 47 | |
48 | - public function manager() |
|
48 | + public function manager () |
|
49 | 49 | { |
50 | - return $this->belongsTo(\App\Models\Manager::class); |
|
50 | + return $this->belongsTo (\App\Models\Manager::class); |
|
51 | 51 | } |
52 | 52 | |
53 | - public function team_culture_translations() //phpcs:ignore |
|
53 | + public function team_culture_translations () //phpcs:ignore |
|
54 | 54 | { |
55 | - return $this->hasMany(\App\Models\TeamCultureTranslation::class); |
|
55 | + return $this->hasMany (\App\Models\TeamCultureTranslation::class); |
|
56 | 56 | } |
57 | 57 | } |
@@ -63,29 +63,29 @@ discard block |
||
63 | 63 | 'skill_level' |
64 | 64 | ]; |
65 | 65 | |
66 | - public function criteria_type() //phpcs:ignore |
|
66 | + public function criteria_type () //phpcs:ignore |
|
67 | 67 | { |
68 | - return $this->belongsTo(\App\Models\Lookup\CriteriaType::class); |
|
68 | + return $this->belongsTo (\App\Models\Lookup\CriteriaType::class); |
|
69 | 69 | } |
70 | 70 | |
71 | - public function job_poster() //phpcs:ignore |
|
71 | + public function job_poster () //phpcs:ignore |
|
72 | 72 | { |
73 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
73 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
74 | 74 | } |
75 | 75 | |
76 | - public function skill() |
|
76 | + public function skill () |
|
77 | 77 | { |
78 | - return $this->belongsTo(\App\Models\Skill::class); |
|
78 | + return $this->belongsTo (\App\Models\Skill::class); |
|
79 | 79 | } |
80 | 80 | |
81 | - public function skill_level() //phpcs:ignore |
|
81 | + public function skill_level () //phpcs:ignore |
|
82 | 82 | { |
83 | - return $this->belongsTo(\App\Models\Lookup\SkillLevel::class); |
|
83 | + return $this->belongsTo (\App\Models\Lookup\SkillLevel::class); |
|
84 | 84 | } |
85 | 85 | |
86 | - public function criteria_translations() //phpcs:ignore |
|
86 | + public function criteria_translations () //phpcs:ignore |
|
87 | 87 | { |
88 | - return $this->hasMany(\App\Models\Lookup\CriteriaTypeTranslation::class); |
|
88 | + return $this->hasMany (\App\Models\Lookup\CriteriaTypeTranslation::class); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | /** |
@@ -93,9 +93,9 @@ discard block |
||
93 | 93 | * |
94 | 94 | * @return \Illuminate\Database\Eloquent\Collection |
95 | 95 | */ |
96 | - public function assessments() // phpcs:ignore |
|
96 | + public function assessments () // phpcs:ignore |
|
97 | 97 | { |
98 | - return $this->hasMany(\App\Models\Assessment::class, 'criterion_id'); |
|
98 | + return $this->hasMany (\App\Models\Assessment::class, 'criterion_id'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @return string |
105 | 105 | */ |
106 | - public function getLevelNameAttribute(): string |
|
106 | + public function getLevelNameAttribute (): string |
|
107 | 107 | { |
108 | 108 | $level = $this->skill_level->name; |
109 | 109 | $type = $this->skill->skill_type->name; |
110 | - return Lang::get("common/lookup/skill_level.$level.$type.name"); |
|
110 | + return Lang::get ("common/lookup/skill_level.$level.$type.name"); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
@@ -115,10 +115,10 @@ discard block |
||
115 | 115 | * |
116 | 116 | * @return string |
117 | 117 | */ |
118 | - public function getLevelDescriptionAttribute() : string |
|
118 | + public function getLevelDescriptionAttribute () : string |
|
119 | 119 | { |
120 | 120 | $level = $this->skill_level->name; |
121 | 121 | $type = $this->skill->skill_type->name; |
122 | - return Lang::get("common/lookup/skill_level.$level.$type.description"); |
|
122 | + return Lang::get ("common/lookup/skill_level.$level.$type.description"); |
|
123 | 123 | } |
124 | 124 | } |
@@ -26,7 +26,7 @@ |
||
26 | 26 | 'things_to_know' |
27 | 27 | ]; |
28 | 28 | |
29 | - public function work_environment() { |
|
30 | - return $this->belongsTo(\App\Models\WorkEnvironment::class); |
|
29 | + public function work_environment () { |
|
30 | + return $this->belongsTo (\App\Models\WorkEnvironment::class); |
|
31 | 31 | } |
32 | 32 | } |
@@ -270,84 +270,84 @@ discard block |
||
270 | 270 | ]; |
271 | 271 | |
272 | 272 | // @codeCoverageIgnoreStart |
273 | - public function department() // phpcs:ignore |
|
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 | - public function job_term() // phpcs:ignore |
|
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 | - public function language_requirement() // phpcs:ignore |
|
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 | - public function manager() // phpcs:ignore |
|
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 | - public function province() // phpcs:ignore |
|
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 | - public function security_clearance() // phpcs:ignore |
|
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 | - public function criteria() // phpcs:ignore |
|
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 | - public function job_applications() // phpcs:ignore |
|
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 | - public function job_poster_key_tasks() // phpcs:ignore |
|
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 | - public function job_poster_questions() // phpcs:ignore |
|
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 | - public function job_poster_translations() // phpcs:ignore |
|
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 | - public function telework_allowed_frequency() // phpcs:ignore |
|
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 | - public function flexible_hours_frequency() // phpcs:ignore |
|
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 | - public function travel_requirement() // phpcs:ignore |
|
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 | - public function overtime_requirement() // phpcs:ignore |
|
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 | - public function classification() // phpcs:ignore |
|
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 */ |
@@ -358,10 +358,10 @@ discard block |
||
358 | 358 | * |
359 | 359 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
360 | 360 | */ |
361 | - public function submitted_applications() // phpcs:ignore |
|
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 | |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | * |
379 | 379 | * @return \Illuminate\Database\Eloquent\Model|null |
380 | 380 | */ |
381 | - public function resolveRouteBinding($value) // phpcs:ignore |
|
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 | /** |
@@ -391,10 +391,10 @@ discard block |
||
391 | 391 | * |
392 | 392 | * @return void |
393 | 393 | */ |
394 | - public function setPublishedAttribute($value): void |
|
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 | } |
@@ -406,9 +406,9 @@ discard block |
||
406 | 406 | |
407 | 407 | /* Methods */ |
408 | 408 | |
409 | - public function submitted_applications_count() //phpcs:ignore |
|
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 | /** |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | * |
417 | 417 | * @return string[] |
418 | 418 | */ |
419 | - public function applyBy(): array |
|
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; |
@@ -438,9 +438,9 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @return string |
440 | 440 | */ |
441 | - public function displayStatus(): string |
|
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 | /** |
@@ -448,13 +448,13 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @return boolean |
450 | 450 | */ |
451 | - public function isOpen(): bool |
|
451 | + public function isOpen (): bool |
|
452 | 452 | { |
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 | /** |
@@ -462,13 +462,13 @@ discard block |
||
462 | 462 | * |
463 | 463 | * @return boolean |
464 | 464 | */ |
465 | - public function isClosed(): bool |
|
465 | + public function isClosed (): bool |
|
466 | 466 | { |
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 | /** |
@@ -476,9 +476,9 @@ discard block |
||
476 | 476 | * |
477 | 477 | * @return string |
478 | 478 | */ |
479 | - public function timeRemaining(): string |
|
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 | /** |
@@ -510,12 +510,12 @@ discard block |
||
510 | 510 | * |
511 | 511 | * @return string |
512 | 512 | */ |
513 | - public function status(): string |
|
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'; |
@@ -532,7 +532,7 @@ discard block |
||
532 | 532 | * |
533 | 533 | * @return string|null |
534 | 534 | */ |
535 | - public function getClassificationCodeAttribute() |
|
535 | + public function getClassificationCodeAttribute () |
|
536 | 536 | { |
537 | 537 | if ($this->classification_id !== null) { |
538 | 538 | return $this->classification->key; |
@@ -546,10 +546,10 @@ discard block |
||
546 | 546 | * |
547 | 547 | * @return string|null |
548 | 548 | */ |
549 | - public function getClassificationMessageAttribute() |
|
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 | } |
@@ -560,9 +560,9 @@ discard block |
||
560 | 560 | * |
561 | 561 | * @return mixed[] |
562 | 562 | */ |
563 | - public function toApiArray(): array |
|
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 | } |
@@ -34,9 +34,9 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
36 | 36 | */ |
37 | - public function job_poster(): \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
37 | + public function job_poster (): \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
38 | 38 | { |
39 | - return $this->belongsTo(\App\Models\JobPoster::class); |
|
39 | + return $this->belongsTo (\App\Models\JobPoster::class); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * |
45 | 45 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
46 | 46 | */ |
47 | - public function assessment_type(): \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
47 | + public function assessment_type (): \Illuminate\Database\Eloquent\Relations\BelongsTo |
|
48 | 48 | { |
49 | - return $this->belongsTo(\App\Models\Lookup\AssessmentType::class); |
|
49 | + return $this->belongsTo (\App\Models\Lookup\AssessmentType::class); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | * |
55 | 55 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
56 | 56 | */ |
57 | - public function rating_guide_answers(): \Illuminate\Database\Eloquent\Relations\HasMany |
|
57 | + public function rating_guide_answers (): \Illuminate\Database\Eloquent\Relations\HasMany |
|
58 | 58 | { |
59 | - return $this->hasMany(\App\Models\RatingGuideAnswer::class); |
|
59 | + return $this->hasMany (\App\Models\RatingGuideAnswer::class); |
|
60 | 60 | } |
61 | 61 | } |
@@ -35,8 +35,8 @@ |
||
35 | 35 | 'how_we_work' |
36 | 36 | ]; |
37 | 37 | |
38 | - public function team_culture() //phpcs:ignore |
|
38 | + public function team_culture () //phpcs:ignore |
|
39 | 39 | { |
40 | - return $this->belongsTo(\App\Models\TeamCulture::class); |
|
40 | + return $this->belongsTo (\App\Models\TeamCulture::class); |
|
41 | 41 | } |
42 | 42 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | * |
18 | 18 | * @return Date |
19 | 19 | */ |
20 | - public function freshTimestamp() |
|
20 | + public function freshTimestamp () |
|
21 | 21 | { |
22 | 22 | return new Date; |
23 | 23 | } |
@@ -28,15 +28,15 @@ discard block |
||
28 | 28 | * @param mixed $value |
29 | 29 | * @return Date |
30 | 30 | */ |
31 | - protected function asDateTime($value) |
|
31 | + protected function asDateTime ($value) |
|
32 | 32 | { |
33 | - $timezone = Config::get('app.timezone'); |
|
33 | + $timezone = Config::get ('app.timezone'); |
|
34 | 34 | |
35 | 35 | // If this value is already a Carbon instance, we shall just return it as is. |
36 | 36 | // This prevents us having to re-instantiate a Carbon instance when we know |
37 | 37 | // it already is one, which wouldn't be fulfilled by the DateTime check. |
38 | 38 | if ($value instanceof Carbon) { |
39 | - return Date::parse($value, $timezone); |
|
39 | + return Date::parse ($value, $timezone); |
|
40 | 40 | } |
41 | 41 | if ($value instanceof Date) { |
42 | 42 | return $value; |
@@ -45,35 +45,35 @@ discard block |
||
45 | 45 | // these checks since they will be a waste of time, and hinder performance |
46 | 46 | // when checking the field. We will just return the DateTime right away. |
47 | 47 | if ($value instanceof DateTimeInterface) { |
48 | - return new Date( |
|
48 | + return new Date ( |
|
49 | 49 | //$value->format('Y-m-d H:i:s.u'), $value->getTimeZone() |
50 | - $value->format('Y-m-d H:i:s.u'), $timezone |
|
50 | + $value->format ('Y-m-d H:i:s.u'), $timezone |
|
51 | 51 | ); |
52 | 52 | } |
53 | 53 | // If this value is an integer, we will assume it is a UNIX timestamp's value |
54 | 54 | // and format a Carbon object from this timestamp. This allows flexibility |
55 | 55 | // when defining your date fields as they might be UNIX timestamps here. |
56 | - if (is_numeric($value)) { |
|
57 | - return Date::createFromTimestamp($value, $timezone); |
|
56 | + if (is_numeric ($value)) { |
|
57 | + return Date::createFromTimestamp ($value, $timezone); |
|
58 | 58 | } |
59 | 59 | // If the value is in simply year, month, day format, we will instantiate the |
60 | 60 | // Carbon instances from that format. Again, this provides for simple date |
61 | 61 | // fields on the database, while still supporting Carbonized conversion. |
62 | - if (preg_match('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value)) { |
|
63 | - return Date::createFromFormat('Y-m-d', $value, $timezone)->startOfDay(); |
|
62 | + if (preg_match ('/^(\d{4})-(\d{1,2})-(\d{1,2})$/', $value)) { |
|
63 | + return Date::createFromFormat ('Y-m-d', $value, $timezone)->startOfDay (); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | // If the date follows the api configured date format, use that. |
67 | - $apiFormat = Config::get('app.api_datetime_format'); |
|
68 | - $date = DateTime::createFromFormat($apiFormat, $value); |
|
69 | - if ($date && $date->format($apiFormat) == $value) { |
|
67 | + $apiFormat = Config::get ('app.api_datetime_format'); |
|
68 | + $date = DateTime::createFromFormat ($apiFormat, $value); |
|
69 | + if ($date && $date->format ($apiFormat) == $value) { |
|
70 | 70 | return $date; |
71 | 71 | } |
72 | 72 | |
73 | 73 | // Finally, we will just assume this date is in the format used by default on |
74 | 74 | // the database connection and use that format to create the Carbon object |
75 | 75 | // that is returned back out to the developers after we convert it here. |
76 | - return Date::createFromFormat($this->getDateFormat(), $value, $timezone); |
|
76 | + return Date::createFromFormat ($this->getDateFormat (), $value, $timezone); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @param DateTimeInterface $date |
83 | 83 | * @return void |
84 | 84 | */ |
85 | - protected function serializeDate(DateTimeInterface $date) |
|
85 | + protected function serializeDate (DateTimeInterface $date) |
|
86 | 86 | { |
87 | - return $date->format(Config::get('app.api_datetime_format')); |
|
87 | + return $date->format (Config::get ('app.api_datetime_format')); |
|
88 | 88 | } |
89 | 89 | } |