samedi 1 octobre 2016

Eloquent - group by "from date" to "to date" with a one day interval

I have a Reservation model which has date_from and date_to fields.

How can reservations be grouped by one day interval, so it is possible to know how many of them are active on a particular date?

Example

Reservation::groupBy('...')->get()

Output:

reservations
==================
qty | date
------------------
3   | 2000-01-01
5   | 2000-01-02
2   | 2000-01-03
...



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2dlCyun
via IFTTT

Aucun commentaire:

Enregistrer un commentaire