Route query string values don't persist with pagination in Table
Hello , good evening i need help here is my code :
how to make the table not forget about
request()->get('record')
thanks8 Replies
Is this inside a resouece view page or a custom resource page?
You should be able to do something like $this->getRecord()
it is inside a resource
class BeneficiaryTransactionResource extends Resource
If record is a custom query parameter you set on the get request to your BeneficiaryTransactionResource list page you can do this:
One way you could achieve this is by making a ListBeneficiaryTransactionResource class (should have this file already as filament auto created them if you use the resource helper)
Then inside that list class add a url property (livewire auto sets this based on the url query param:
#[Url]
public $record = '';
Then you can create a function inside the same class that modifies the table query for the resource like:
protected function getTableQuery(): Builder
{
dd($this->record);
return parent::getTableQuery()
->where('user_id', $this->record)
}
Also remember to import
use Livewire\Attributes\Url;
this is what i have but still doest work , getTableQuery is completely ignored
You need to place these in the
ListBeneficiaryTransaction
class. Sorry if i wasnt clear in the last message as you need a livewire component to manage your custom statethanks this works,
after i added in my
ManageRecords
Good to hear happy to help 🙂 🙌
thanks indeed