-
Hi, I am using the query builder for users to filter and sort tabular data tables and it works perfectly. Is there a standard way to allow the query builder to reapply these filters or do I need to go the route of extending the class QueryBuilderRequest? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Ended up solving this by realizing that you can send a request as the 2nd parameter to the In the excel export (using FromQuery): public function __construct(public $requestQuery = null)
{
$this->requestQuery = request()->query();
}
public function query()
{
$request = app(QueryBuilderRequest::class)->merge($this->requestQuery);
return QueryBuilder::for(User::class, $request);
} |
Beta Was this translation helpful? Give feedback.
-
It does not work for me.
I can see the $request->get('filter') is right but the QueryBuilder do not care about it. It does not filter the date according this filter. |
Beta Was this translation helpful? Give feedback.
-
I forgot to add allowedFilters() to the QueryBuilder |
Beta Was this translation helpful? Give feedback.
Ended up solving this by realizing that you can send a request as the 2nd parameter to the
for()
method.Placing what I needed to add just in case someone else is doing the same or similar.
In the excel export (using FromQuery):