Using Scout, relationship search on HasMany
field returns results from all resources, not scoped to certain resource
#6622
Labels
Milestone
Description:
When using a
HasMany
relationship between resources (e.g.,Supplier
andProduct
where aSupplier
has manyProducts
), searching through the related resource from the parent resource's page does not properly scope the results.E.g. In certain supplier page (
/nova/resources/suppliers/60
) I search for Product with querytest
, and the results come from all supplier, not the one with ID 60.Product
resource has Scout enabled.Detailed steps to reproduce the issue on a fresh Nova installation:
Product
resource.Supplier
page in Laravel Nova.Products
relationship field.Workaround
As a workaround, this code can be used in
Product
resource:In Laravel Nova documentation you can find this:
So it's not totally true, if the search does not scope the results via relationships :)
The text was updated successfully, but these errors were encountered: