mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
34 lines
994 B
PHP
34 lines
994 B
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\System\ExamResource\Pages;
|
|
|
|
use App\Filament\Resources\System\ExamResource;
|
|
use App\Repositories\ExamRepository;
|
|
use Filament\Pages\Actions;
|
|
use Filament\Resources\Pages\EditRecord;
|
|
|
|
class EditExam extends EditRecord
|
|
{
|
|
protected static string $resource = ExamResource::class;
|
|
|
|
protected function getHeaderActions(): array
|
|
{
|
|
return [
|
|
Actions\DeleteAction::make(),
|
|
];
|
|
}
|
|
|
|
public function save(bool $shouldRedirect = true, bool $shouldSendSavedNotification = true): void
|
|
{
|
|
$data = $this->form->getState();
|
|
$examRep = new ExamRepository();
|
|
try {
|
|
$this->record = $examRep->update($data, $this->record->id);
|
|
$this->notify('success', $this->getSavedNotificationTitle());
|
|
$this->redirect($this->getResource()::getUrl('index'));
|
|
} catch (\Exception $exception) {
|
|
$this->notify('danger', $exception->getMessage());
|
|
}
|
|
}
|
|
}
|