Custom page with resource record error
I have a custom page:
And I try to pickup the ticketId and fill the form with the following code:
But I’m getting error: Typed property App\Filament\App\Resources\TicketResource\Pages\TicketWithComments::$ticket must not be accessed before initialization
What am I doing wrong?
public static function getPages(): array
{
return [
'ticketWithComments' => Pages\TicketWithComments::route('/{ticketId}/ticketwithcomments'),
…
];
} And I try to pickup the ticketId and fill the form with the following code:
public function mount($ticketId): void
{
$this->ticket = Ticket::findOrFail($ticketId);
$this->form->fill($this->ticket->attributesToArray());
}But I’m getting error: Typed property App\Filament\App\Resources\TicketResource\Pages\TicketWithComments::$ticket must not be accessed before initialization
What am I doing wrong?