0
我想利用未读以及他们create_at
日期是低于或等于特定日期的特定用户的最大3通知,我想是这样波纹管查询:如何在laravel中写入此查询?
select count(*) as aggregate from
(
select * from `notifications`
where `notifications`.`user_id` = '20' and `notifications`.`user_id` is not null and `is_read` = '0'
and created_at <= '2015-07-12 11:41:10' limit 3
) AS src
只是恳求考虑波纹管查询:
$displayedNotifications = $user->notifications(function($query) use ($timestamps) {
return $query->Where('created_at', '<=', $timestamps);
})->unread()->take(3)->count();