@ Ronster
Try this:
$matches = Match::where('starting_at', '>', Carbon::now()->subMinutes(30)
->where('starting_at', '<', Carbon::now()->addMinutes(210))
->get();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I'm having difficulties writing a query (in eloquent) but also without.
I am hosting livescores for soccer matches. I want to return all the matches that are currently being played. I have a field called starting_at with holds a datetime with starting date/time of the match. I want to show the matches 30 minutes before they begin and 30 minutes after they have stopped. you can assume that a match takes no longer then 3 hours (extratime/penalty shootout etc)
When using interval I, at some point, are missing matches since the starting_at is before now-interval 30 minutes.
Is there a mysql guru here that can help me with this?
thanks
Please or to participate in this conversation.