Count from each distinct date, fill in missing dates with zero
问题 I'm trying to create an Eloquent query that gets the total number of posts made each distinct day, and if the date is missing, fill it in with a value of zero. For example, if my table looks like this: +----+---------------------+ | id | date | +----+---------------------+ | 1 | 2015-01-01 00:00:00 | | 2 | 2015-01-01 01:53:18 | | 3 | 2015-01-01 02:41:26 | | 4 | 2015-01-02 12:51:01 | | 5 | 2015-01-05 08:24:12 | +----+---------------------+ This would output: 2015-01-01 : 3 2015-01-02 : 1 2015