我有这个简单的查询,分组电子邮件地址。我注意到当我使用whereDate时,当我使用$ users-> count()时,它总是返回0计数。但是,当我删除date where子句时,它返回预期的结果。有人可以帮我吗?提前谢谢!
$users = Wfa::where('subscribe', 1)
->where('locale', $locale)
->whereDate($whichDateColumn, '=', $queryDate->format('Y-m-d'))
->groupBy('email')
->orderBy('id', 'asc')
->get();
dd($users)
/* output - returns 0 items
Illuminate\Database\Eloquent\Collection {#629
#items: []
}
*/
/*this returns 0 results.*/
$users->count();
/*using the same query - this foreach works and can loop through the result set.*/
foreach($users as $user){
dd($user); #this shows the user details/collection
}
我正在使用laravel 5.0.35;升级不是一种选择:(