Hi, I created a custom page ViewTickets from RootInformationResource. I want to fetch the hasMany relation data from the Participants table, but instead, I got an error like this. How to use the model inside the custom page resource I think I wrote the code wrong Thank you, and may your day be blessed!
<?phpnamespace App\Filament\Resources\RootInformationResource\Pages;use App\Filament\Resources\RootInformationResource;use Filament\Resources\Pages\Page;use Filament\Resources\Pages\Concerns\InteractsWithRecord;class ViewTickets extends Page{ use InteractsWithRecord; protected static string $resource = RootInformationResource::class; protected static string $view = 'filament.resources.root-information-resource.pages.view-tickets'; public function mount(int | string $record): void { $this->record = $this->resolveRecord($record); } public function getViewData(): array { $getData = Participant::where('idRootInfo',$this->record->id)->pluck('nameParticipant','ulid'); return $getData; }}
<?phpnamespace App\Filament\Resources\RootInformationResource\Pages;use App\Filament\Resources\RootInformationResource;use Filament\Resources\Pages\Page;use Filament\Resources\Pages\Concerns\InteractsWithRecord;class ViewTickets extends Page{ use InteractsWithRecord; protected static string $resource = RootInformationResource::class; protected static string $view = 'filament.resources.root-information-resource.pages.view-tickets'; public function mount(int | string $record): void { $this->record = $this->resolveRecord($record); } public function getViewData(): array { $getData = Participant::where('idRootInfo',$this->record->id)->pluck('nameParticipant','ulid'); return $getData; }}