Level 29
You can chain your wheres, like where(condition1 ...) -> where(condition2) -> get();
Also, check out whereRaw if you need to do some modification on the fields.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How can I do a SELECT where a date is < three weeks old and also matches an ID?
Bit like this:
$availableProductID = AvailableProduct::where('product_id', '=', $productID, 'made_available', '<', $weeksAvailableFor )->get();
$results = AvailableProduct::where('product_id', '=', $productID)
->where('made_available', '<', Carbon::now()->subWeeks(3))
->get();
Please or to participate in this conversation.