mardi 15 octobre 2019

How to write this raw query in Eloquent

I have a sql query, and i want to know if it can be written in eloquent.

There are two tables Brands and Products.

I am trying to get the brands which are in particular category of products

Below is how it looks currently

\DB::select('select * FROM brands WHERE id in ( select brand_id from products WHERE category_id IN (220, 222, 223) GROUP by brand_id )');

The above is working, i want help on converting it to eloquent.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/35E69J5
via IFTTT

Aucun commentaire:

Enregistrer un commentaire