F
Filament•10mo 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•10mo 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
terumi•10mo 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•10mo ago
This isn't available in the docs... check the source code ✌️
terumi
terumi•10mo ago
❤️ thank you again!