1 week ago

How to search for an item with relationships (SOLVED)

Posted 1 week ago by himala

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 sign in or create an account to participate in this conversation.