Declaration of Filament\Actions\Concerns\InteractsWithRecord::getModel()
i am using InteractsWithRecord on custom page and i get the above error, can anyone help me with it?
8 Replies
is that the complete error?
Send code snippet also @Bloom
This is the complete error given
This is the custom page on which i am trying to use record send from an action and below is the action that route to the custom page
Indeed,
getModel()
in InteractsWithRecord
returns ?string
but Page
returns string
(not nullable). And Page:;getModel is a getter from Resource::getModel
which also returns string
not nullable.
https://github.com/filamentphp/filament/blob/a08bcc7f6859413ed8aaf52d7d59f8dc5179b211/packages/actions/src/Concerns/InteractsWithRecord.php#L121
https://github.com/filamentphp/filament/blob/a08bcc7f6859413ed8aaf52d7d59f8dc5179b211/packages/panels/src/Resources/Pages/Page.php#L137
https://github.com/filamentphp/filament/blob/a08bcc7f6859413ed8aaf52d7d59f8dc5179b211/packages/panels/src/Resources/Resource.php#L473GitHub
filament/packages/panels/src/Resources/Pages/Page.php at a08bcc7f68...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
GitHub
filament/packages/panels/src/Resources/Resource.php at a08bcc7f6859...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
GitHub
filament/packages/actions/src/Concerns/InteractsWithRecord.php at a...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS. - filamentphp/filament
i have no clue what you are trying to say
So i made getModel() not nullable inside InteractsWithRecord
And in my custom page i make it like this
It works but i don't know if it is the right way to achieve, since i am quering multiple times
In part I was pointing out that maybe there's a bug in the trait, because if they're meant to be used together then they should be compatible. So if they're not compatible then maybe it's a bug, or you're including the wrong trait. But I'm surprised more aren't complaining of the same thing.
But there are others around here who'd know more than me about doing what you're trying to do.
i am looking at this documentation https://filamentphp.com/docs/3.x/panels/resources/custom-pages#using-a-resource-record, i don't see where i used different trait
And the way resolveRecord() is explained in the documentaion is quite confusing
I hope it doesn't hinder performance