如何获取过去24小时或过去30天内创建的数据
$last['last_trades'] = Credit::where
('user_id', $user->id)->where('description',
'#1 Bonus Trade')->where('currency_code', 'LTC')->limit(5)->orderby
('created_at', 'DESC')->get();
答案 0 :(得分:0)
使用碳:
use Carbon\Carbon;
...
$last['last_trades'] = Credit::where('user_id', $user->id)
->where('description', '#1 Bonus Trade')
->where('currency_code', 'LTC')
->where('created_at', '>', Carbon::now()->subDays(30)->startOfDay())
->limit(5)
->orderBy('created_at', 'DESC')
->get()