2 回答
TA贡献1802条经验 获得超10个赞
仅获取今天的记录
use Carbon\Carbon;
public function getNextEventsList()
{
return EventCalendar::active()->with(['localization', 'category'])->where('visible_on_promo_box', '=', 1)->where('date_from', Carbon::today())->orderBy('date_from', 'ASC')->get();
}
获取明天的记录
use Carbon\Carbon;
public function getNextEventsList()
{
return EventCalendar::active()->with(['localization', 'category'])->where('visible_on_promo_box', '=', 1)->where('date_from', Carbon::tomorrow())->orderBy('date_from', 'ASC')->get();
}
按年份范围获取
use Carbon\Carbon;
public function getNextEventsList()
{
return EventCalendar::active()->with(['localization', 'category'])->where('visible_on_promo_box', '=', 1)->where('date_from', '>=', Carbon::now())->where('date_from', '<=', Carbon::now()->addYear())->orderBy('date_from', 'ASC')->get();
}
TA贡献1934条经验 获得超2个赞
获取今天或第二天发生的记录。
EventCalendar::active()->with(['localization', 'category'])->where('visible_on_promo_box', '=', 1)->whereIn('date_from',[Carbon::today(),Carbon:tomarrow()])->get()
- 2 回答
- 0 关注
- 108 浏览
添加回答
举报