I am stuck at rewriting mysql query to laravel eloquent.
LEFT JOIN `products_options` ON `products_options`.`id` = (
SELECT products_options.id FROM products_options WHERE 1
AND products_options.product_id = products.id
AND products_options.color = $color
)
Any help?
To replicate that query use the following
Your query looks a little off but this is it replicated using the eloquent query builder. Don't forget to reference DB in your controller or model