Issue with getEloquentQuery, query and Action

I am doing this in a resource, it works good but for example if it is filtering $filter_stock = request()->query('filterStock'); and I click on an action, that query returns null and it still being in the url, how can I solve this?
5 Replies
Yeraldi29#2900
Yeraldi29#2900OP2y ago
that's not the behaviour that I need, I tried to solve it with Session but it makes errors if I have multiple tags opened
Dennis Koch
Dennis Koch2y ago
Put it on a Livewire property. The request() part is lost, when making Livewire requests.
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Thank you I will investigate Sorry, I don't understand how can I achieve it, I am trying to do this but gives me null public static $filterUser; public static $filterStock; protected $queryString = [ 'tableFilters', 'tableSortColumn', 'tableSortDirection', 'tableSearchQuery' => ['except' => ''], 'tableColumnSearchQueries', 'filterUser', 'filterStock' ]; At the beginning I tried to do it with the mount and access it with the $this-> but it is not compatible Does anybody have an idea? I cannot find a solution 😦
Patrick Boivin
In the mount() method of your page, grab what you need from the request and put it in a global property (e.g. $this->filterStock = request()->query( ... )) Otherwise, as Dennis mentionned, the initial request() is lost when Livewire is doing AJAX behind the scenes Oh, I see what you mean! The getEloquentQuery() method is static. Use getTableQuery() instead, on the page class
Yeraldi29#2900
Yeraldi29#2900OP2y ago
Thank you for the answer, yes that's the problem I was trying to do a filter hidded but it does not work Oh, I will try, thank you It worked very good, thank you vary much, I spent many hours
Want results from more Discord servers?
Add your server