Call to a member function getForeignKeyName() on null

I have a static method for the GetForm and upon creation of a new record i get the error above, i dont quite get how to go about it. Here are the snippets Admission.php(model)
2 Replies
Desmond Njuguna
Desmond NjugunaOP4mo ago
ListAdmissions.php <?php namespace App\Filament\Clusters\Patients\Resources\AdmissionResource\Pages; use App\Filament\Clusters\Patients\Resources\AdmissionResource; use App\Models\Configurations\Bed; use Filament\Actions; use Filament\Resources\Pages\ListRecords; use Illuminate\Support\Str; class ListAdmissions extends ListRecords { protected static string $resource = AdmissionResource::class; protected function getHeaderActions(): array { return [ Actions\CreateAction::make() ->icon('heroicon-o-squares-plus') ->label('Admit Patient') ->mutateFormDataUsing(function (array $data): array { unset($data['ward_id']); unset($data['room_id']); $data['identification'] = Str::uuid(); return $data; }) ->after(function() { $admission = $this->getRecord(); Bed::find($admission->bed_id)->booked(); }), ]; } }
Desmond Njuguna
Desmond NjugunaOP4mo ago
Want results from more Discord servers?
Add your server