Closed diveshahuja closed 2 months ago
Hallo @diveshahuja
working fine for me when i am using group_id instead of id in the filter definition, where group_id is the relational field on the main table. but i am not sure about your tables structure.
Filter::multiSelect('groups', 'group_id')
or you can also customize the filter query with builder instead of filterRelation.
->builder(function (Builder $query, mixed $value) {
$query->whereHas('groups', function ($query) use ($value) {
return $query->whereIn('id', $value);
});
}),
I think using the builder as @eafarooqi mentioned is safer than supporting this specifically in this filter.
Thanks
Have you searched through other issues to see if your problem is already reported or has been fixed?
Yes, I did not find it.
Did you read the documentation?
Yes, I did not find it.
Have you tried to publish the views?
No, this error is not related to views.
Is there an error in the console?
No
PHP Version
8.2
PowerGrid
5.8.1
Laravel
10.48.14
Livewire
3.5
Alpine JS
No response
Theme
Bootstrap
Describe the bug.
I wanted to apply a relation search on multi select and it was not working then i went through your code and saw that WithMultiSelectBuilder trait doesn't have whereHas or whereHasMorph just like InputText
To Reproduce...
First click on "FOO" then....
Extra information