'=', 'created_at' => 'like', ]; public function model() { return Model::class; } /** * 数据格式化 * * @param mixed $result * * @return mixed */ public function transform($model) { $model->url = cdn($model->disk, $model->filename, $model->created_at); $model->cover = $model->thumb ? cdn($model->disk, FileService::getThumb($model->filename), $model->created_at) : ''; return $model; } public function withConditions(array $conditions =[]) { if (isset($conditions['ids'])) { $this->model = $this->model->whereIn('id', $conditions['ids']); } if (isset($conditions['creator'])) { $this->model = $this->model->where('creator', $conditions['creator']); } if (isset($conditions['type'])) { $this->model = $this->model->where('type', $conditions['type']); } return $this; } }