22 lines
475 B
PHP
22 lines
475 B
PHP
<?php
|
||
|
||
namespace App\Traits;
|
||
|
||
use Illuminate\Support\Carbon;
|
||
use Illuminate\Support\Facades\Http;
|
||
|
||
trait DateTimeTrait
|
||
{
|
||
/**
|
||
* Return “yes” / “planned” / “no” based on $field’s timestamp.
|
||
*/
|
||
protected function dateStatus(?string $ts): string
|
||
{
|
||
if (is_null($ts)) {
|
||
return __('no');
|
||
}
|
||
$dt = \Illuminate\Support\Carbon::parse($ts);
|
||
return $dt->isFuture() ? __('planned') : __('yes');
|
||
}
|
||
}
|