The easiest way:
$from = '2014-08-10 09:30:00';
$till = '2014-08-10 11:00:00';
$collection = Model::whereBetween('your_field', [$from, $till])->get();
Adjust it to the date format you use. Utilize Carbon if you like.
Thank you! That worked as a charm for periods of time, but I reckon that it doesn't for cases like "get me all the things in the database from June to July between 09:00 and 11:00 every day".
In that case should you perform some database specific functions or is it a nicer way to tackle this? Thank you.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community