48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\Column;
|
|
use Illuminate\Support\Carbon;
|
|
|
|
class ColumnStarttime extends Column
|
|
{
|
|
protected string $view = 'filament.tables.columns.column-starttime';
|
|
|
|
protected $starttime;
|
|
|
|
protected $tx;
|
|
|
|
protected $cl;
|
|
|
|
protected $color;
|
|
|
|
public function setTime($record)
|
|
{
|
|
$this->tx = Carbon::createFromTimestamp(strtotime($record->starttime));
|
|
if ($record->event_bookmaker?->starttime) {
|
|
$this->cl = Carbon::createFromTimestamp(strtotime($record->event_bookmaker?->starttime));
|
|
$this->starttime = Carbon::createFromTimestamp(strtotime($record->event_bookmaker?->starttime));
|
|
|
|
if ($this->tx == $this->cl) {
|
|
$this->color = 'text-green-600';
|
|
} else {
|
|
$this->color = 'text-orange-600';
|
|
}
|
|
} else {
|
|
$this->color = 'text-blue-600';
|
|
$this->starttime = Carbon::createFromTimestamp(strtotime($record->starttime));
|
|
}
|
|
}
|
|
|
|
public function getColor()
|
|
{
|
|
return $this->color;
|
|
}
|
|
|
|
public function getStarttime()
|
|
{
|
|
return $this->starttime;
|
|
}
|
|
}
|