我的代码是 whereRaw("DAY(time) = ?", $day)->get();但是我的代码现在不起作用...我不明白,因为whereRaw("DAY(time) = ?", 5)->get()是做工作。为什么没有工作$day代码?我得到使用时间Carbon::now()并得到一天$time->day;DAY(time) = ?", $day)->get() <不工作DAY(time) = ?", 8)->get() < 工作我不明白。$result = DB::table('show')->whereYear('time',$year)->whereMonth('time',$month)->where(function ($mQuery){$mQuery->whereRaw("DAY(time) = $day")->whereRaw("HOUR(time) >= ?", $hour)->orWhereRaw("DAY(time) > $day");})->get();对不起,我的英语不好。
1 回答
皈依舞
TA贡献1851条经验 获得超3个赞
我解决了这个问题。
我没有用这个
使用 ($day, $hour)
<< 所以,我的代码没有得到 $day, $hour ...
我的代码 $day, $hour 为空。
更改我的代码->
$result = DB::table('board_show')->whereYear('time',$year)->whereMonth('time',$month)->where(function ($mQuery) use ($day, $hour) {$mQuery->whereRaw("DAY(time) = ?", [$day])->whereRaw("HOUR(time) >= ?", [$hour])->orWhereRaw("DAY(time) > ?", [$day]);})->get();
- 1 回答
- 0 关注
- 144 浏览
添加回答
举报
0/150
提交
取消