F
Filamentβ€’14mo ago
terumi

Custom page model instance

Hello people, I made a new custom page for a filament resource with
php artisan make:filament-page ShowTicket --resource=TicketResource
php artisan make:filament-page ShowTicket --resource=TicketResource
And it created two files:
1. resources/views/filament/resources/ticket-resource/pages/show-ticket.blade.php, and
2. app/Filament/Resources/TicketResource/Pages/ShowTicket.php
1. resources/views/filament/resources/ticket-resource/pages/show-ticket.blade.php, and
2. app/Filament/Resources/TicketResource/Pages/ShowTicket.php
How can I pass now the instance of the model record whose view link I clicked? I'm being redirected to tickets/{ticket_id} but I cannot find anywhere how I can show the ticket properties. Any help would be greatly apreciated πŸ™‚
Solution:
```php use \Filament\Resources\Pages\Concerns\InteractsWithRecord; public function mount(int | string $record): void { $this->record = $this->resolveRecord($record);...
Jump to solution
4 Replies
Solution
LeandroFerreira
LeandroFerreiraβ€’14mo ago
use \Filament\Resources\Pages\Concerns\InteractsWithRecord;
public function mount(int | string $record): void
{
$this->record = $this->resolveRecord($record);
}
use \Filament\Resources\Pages\Concerns\InteractsWithRecord;
public function mount(int | string $record): void
{
$this->record = $this->resolveRecord($record);
}
terumi
terumiOPβ€’14mo ago
Thank you Leandro! That did the trick for me! Can you please show me, where did you find it in the documentation?
LeandroFerreira
LeandroFerreiraβ€’14mo ago
This isn't available in the docs... check the source code ✌️
terumi
terumiOPβ€’14mo ago
❀️ thank you again!
Want results from more Discord servers?
Add your server