PHPlaravel中从数据库中选择数据是增加时间条件及各种条件

注:附加条件后要加get函数。

1、public function getForDataTable($startTime,$endTime)
{
return $this->query()
->with('a','b')
->select([
'table_name.id',
'table_name.monitor_time',
])
->whereBetween('monitor_time', [$startTime, $endTime])//增加时间条件
->get();

2、$result = Model::whereIn(/*条件1*/)
->whereNotIn(/*条件2*/)
->whereBetween(/*条件3*/)
->where(/*条件4*/)
->orderBy()
->get()

 

posted on 2018-05-08 08:13  七七2020  阅读(302)  评论(0编辑  收藏  举报

导航