feat: initial project setup with Laravel 12 and Filament v4
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Filament\Resources\PrescriptionResource\Pages;
|
||||
|
||||
use App\Filament\Resources\PrescriptionResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Filament\Support\Enums\Width;
|
||||
|
||||
class CreatePrescription extends CreateRecord
|
||||
{
|
||||
protected static string $resource = PrescriptionResource::class;
|
||||
|
||||
protected Width|string|null $maxContentWidth = Width::SevenExtraLarge;
|
||||
|
||||
public string $printType = '';
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['doctor'] = auth()->user()?->name;
|
||||
$data['issue_datetime'] = now();
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
{
|
||||
$record = $this->getRecord();
|
||||
|
||||
if ($this->printType === 'prescription') {
|
||||
return route('prescription.print', $record);
|
||||
}
|
||||
|
||||
if ($this->printType === 'lab') {
|
||||
return route('prescription.print', ['prescription' => $record, 'type' => 'lab']);
|
||||
}
|
||||
|
||||
if ($this->printType === 'admission') {
|
||||
return route('prescription.print.admission', $record);
|
||||
}
|
||||
|
||||
return static::getResource()::getUrl('index');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user