3 回答
![?](http://img1.sycdn.imooc.com/545862120001766302200220-100-100.jpg)
TA贡献1840条经验 获得超5个赞
您可以在任何地方使用数组als。
例如:
$model->where([
['field-one', '=', 'valueOne'],
['field-two', '=', 'valueY']
]);
![?](http://img1.sycdn.imooc.com/545868190001d52602200220-100-100.jpg)
TA贡献1786条经验 获得超11个赞
试试这个:
$bookingSeat = Bookings::where('schedules_id', $request->schedules_id)->where(function ($q) {
$q->where('profile', 'booked')->orWhere('profile', 'pending');
})->get();
或这个:
$profileTypes = ['booked', 'pending'];
$bookingSeat = Bookings::where('schedules_id', $request->schedules_id)->whereIn('profile', $profileTypes)->get();
@编辑
这样,如果您的预订表包含所有已注册(1至50)的座位,它将返回您的个人资料针对特定公交车,路线和时间“预订”或“待定”的所有座位。
$profileTypes = ['booked', 'pending'];
$bookingSeat = Bookings::where('schedules_id', $request->schedules_id)
->whereIn('profile', $profileTypes)
->where('buses_id', $buses_id)
->where('routes_id', $request->route_id)
->get();
![?](http://img1.sycdn.imooc.com/5458655200013d9802200220-100-100.jpg)
TA贡献1856条经验 获得超17个赞
试试这个
Bookings::where('schedules_id', $schedules_id)->where('profile', 'booked')->get();
- 3 回答
- 0 关注
- 156 浏览
添加回答
举报