Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

pafait's avatar

Translate Laravel DB::raw() query with join to Eloquent

hello every one please can some one help me with the equivalent of this query in Eloquent? I'm using Laravel 5.4

SELECT stock_id, prod_id, prix , priority FROM stock as stock INNER JOIN (SELECT * FROM products WHERE sold=false AND brand_id='brand_id') as product ON stock.stock_id = product.id Order By stock.priority;

0 likes
0 replies

Please or to participate in this conversation.