page((int)$where['page'], (int)$where['limit'])->select(); $count = self::setWhere($where)->count(); $data = count($data) ? $data->toArray() : []; return compact('data', 'count'); } public function getApplyStartTimeAttr($time) { return date("Y-m-d", $time); } public function getApplyEndTimeAttr($time) { return date("Y-m-d", $time); } public function getStartTimeAttr($time) { return date("Y-m-d", $time); } public function getEndTimeAttr($time) { return date("Y-m-d", $time); } public static function setWhere($where) { $model = new self(); if ($where['is_show'] !== '') { $model = $model->where('is_show', $where['is_show']); } if ($where['title']) { $model = $model->where("title", 'LIKE', "%{$where['title']}%"); } return $model; } }