Modify query for Select Element on form with relationship based on another form element
I have 2
Select
components on the form. Item Category
and Vendor
. both these fields have belongsToMany
relationship with a pivot table category_vendor
that stores vendors for each category or categories for a vendor. When a user selects a category, I want to display a list of vendors for that category and I am trying to use the modifyQueryUsing
parameter for the relationship
method on the vendor
field. How do I pass the selected category to the vendor
fields query parameter?
1 Reply
Not entirely sure, but you should be able to pass
(Get $get)
in the fn and use $get('item_category_id')
?
Or maybe use a similar logic to this example from dependent dropdown we had in a demo project: