mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 01:44:45 +02:00
29 lines
624 B
PHP
29 lines
624 B
PHP
<?php
|
|
|
|
namespace App\Filament\Components\Tables\Columns;
|
|
|
|
use Filament\Tables\Columns\TextColumn;
|
|
|
|
class DateTimeColumn extends TextColumn
|
|
{
|
|
protected function setUp(): void
|
|
{
|
|
parent::setUp();
|
|
|
|
$this->dateTime();
|
|
}
|
|
|
|
public function since(?string $timezone = null): static
|
|
{
|
|
$this->formatStateUsing(fn ($state) => $state->diffForHumans());
|
|
$this->tooltip(fn ($state) => $state?->timezone($this->getTimezone()));
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getTimezone(): string
|
|
{
|
|
return auth()->user()?->timezone ?? config('app.timezone', 'UTC');
|
|
}
|
|
}
|