Q:

Laravel Query Builder - IN operator

I'm trying to build a query joining multiple tables and I'm having trouble writing a join using an IN operator. Here's an example:
LEFT JOIN sProductDetailWarehouse pdw ON (pdw.ID_sProductDetail = pd.ID AND pdw.ID_sWarehouse IN (52,118)) 

The two values are set and don't need to be parameters....but this doesn't work since there is no IN operator:
->leftJoin('sProductDetailWarehouse as pdw', function($join)
                     {
                         $join->on('pdw.ID_sProductDetail', '=', 'pd.ID');
                         $join->on('pdw.ID_sWarehouse','IN',DB::raw("(52,118)"));
                     })

How can I do that join? I'm sure there's a way to do it, I just can't find it...

A:

When you need to join to data you need to use a 'where' method instead of 'on'
e.g.
->leftJoin('sProductDetailWarehouse as pdw', function($join)
    {
        $join->on('pdw.ID_sProductDetail', '=', 'pd.ID');
        $join->whereIn('pdw.ID_sWarehouse',[52,118]);
    })

