Can you post your models?
May 20, 2020
11
Level 1
How to search for an item with relationships (SOLVED)
I have Products, BranchInventories, and Branch models with hasMany relationships
My Product table has id, and name
and my BranchInventory table has product_id, branch_id
and my Branch table has city, and address
What I want to do is a search item, for example:
the search item is 'All Purpose Flour' and city is 'Manila'
Search for App\Product::where('name', 'LIKE', '%all purpose flour%') AND branch('city', 'Manila') ->get()
Can you please help me? I hope you can understand my question. Thanks in advance
Please or to participate in this conversation.