Level 53
@Swaz Assuming MySQL:
whereRaw('start_date + interval number_of_days day >= ?', [$today]);
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a table like this:
id | publish_date | number_of_days
Is there a way I can add the number_of_days to the publish_date in a where query?
Basically something like this:
->where('start_date', '<=', $today)->where('start_date + number_of_days', '>=', $today)
@Swaz Assuming MySQL:
whereRaw('start_date + interval number_of_days day >= ?', [$today]);
Please or to participate in this conversation.