Closed webard closed 6 months ago
The query you shown above are for searching the dropdown, while
->filterable(function(NovaRequest $request, Builder $query, string $value) {
return $query->where('is_owner', true);
})
will be only be applied to the current resource SQL. Such as
SELECT * FROM `posts` WHERE `is_owner`=1
instead of the default
SELECT * FROM `posts` WHERE `user_id`=?
@crynobone I know that. Why you closed issue without even identyfing use cases?
When we search relation from Edit view, in request data there is info about component, relationship etc. so we can use it to manage query in indexQuery() method.
When searching in filters, there is just /nova-api/resource/search without any additional data like resource, filter name etc. It will be enough to manage search query and it is not breaking change, just couple additional parameters in URL during filter searching.
This change cannot be planned?
From the reply this is a duplicate of https://github.com/laravel/nova-issues/discussions/5097
Description:
I have field named "Owner" which is simply User:
but query from parameter seems to not work during searching in filter:
It seems to query data basing on
$search
property inUser
resource, but does not respect extension of builder from closure.Generated query is:
but should be
Detailed steps to reproduce the issue on a fresh Nova installation: