'=', 'created_at' => 'like', ]; public function model() { return Model::class; } /** * 数据格式化 * * @param mixed $result * * @return mixed */ public function transform($model) { return $model->toArray(); } /** * 使用类型查找 * * @param string $type * @param string|int $typeid * @return void */ public function withType($type, $typeIds) { $typeIds = is_array($typeIds) ? $typeIds : [$typeIds]; $this->model = $this->model->where('type', $type)->whereIn('type_id', $typeIds); return $this; } }