@php use App\Enums\Common\Status; use App\Enums\Content\TimerUsageType; @endphp @props([ 'status' => Status::Draft, 'startAt' => null, 'endAt' => null, 'timerUsageType' => TimerUsageType::None, 'toggleUrl' => null, ]) @php // 現在の日時を取得 $now = now(); if ($status === Status::Publish) { $variant = 'green'; $label = '掲載中'; if ( $timerUsageType === TimerUsageType::From || $timerUsageType === TimerUsageType::Between ) { if ($startAt && $now->isBefore($startAt)) { $variant = 'green-light'; $label = '掲載予定'; } if ($timerUsageType === TimerUsageType::Between) { if ($endAt && $now->isAfter($endAt)) { $variant = 'gray'; $label = '掲載終了'; } } } } else { $variant = 'yellow-soft'; $label = '下書き'; } @endphp
{{ $label }}