select()) && count($data) ? $data->toArray() : []; $count = self::setWhere($where)->count(); return ['count' => $count, 'list' => $data]; } public static function setWhere($where) { $model = (new self); if ($where['name']) { $model = $model->where('name', 'like', '%' . $where['name'] . '%'); } return $model; } }