generated from theradcoza/Laravel-Docker-Dev-Template
42 lines
1.1 KiB
PHP
42 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\ParticipantResource\Pages;
|
|
|
|
use App\Filament\Resources\ParticipantResource;
|
|
use Filament\Actions;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditParticipant extends EditRecord
|
|
{
|
|
protected static string $resource = ParticipantResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Actions\DeleteAction::make(),
|
|
];
|
|
}
|
|
|
|
protected function mutateFormDataBeforeSave(array $data): array
|
|
{
|
|
$minutes = (int) ($data['time_minutes'] ?? 0);
|
|
$seconds = (int) ($data['time_seconds'] ?? 0);
|
|
$milliseconds = (int) ($data['time_milliseconds'] ?? 0);
|
|
|
|
if ($minutes > 0 || $seconds > 0 || $milliseconds > 0) {
|
|
$data['time_ms'] = ($minutes * 60000) + ($seconds * 1000) + $milliseconds;
|
|
} else {
|
|
$data['time_ms'] = null;
|
|
}
|
|
|
|
unset($data['time_minutes'], $data['time_seconds'], $data['time_milliseconds']);
|
|
|
|
return $data;
|
|
}
|
|
|
|
protected function getRedirectUrl(): string
|
|
{
|
|
return $this->getResource()::getUrl('index');
|
|
}
|
|
}
|