2019-04-15sad creeper
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'statistics' doesn't exist (SQL: select count(*) as aggregate from `statistics` where `delivery_time` between 2019-04-02 00:00:00 and 2019-04-07 00:00:00)
这是因为调用了model的whereBetween方法,需要去覆盖model的whereBetween方法
protected $start = null;
protected $end = null;
在方法中用func_get_args()获取接收的参数和传值,然后记录下来,到paginate方法中去拼接sql语句查询
public function whereBetween()
{
$time = func_get_args();
$this->start = $time[1]['start'];
$this->end = $time[1]['end'];
return $this;
}
OK,成功
阅读 724 评论