'like', Default Condition "=" ]; /** * Specify Model class name. * * @return string */ public function model() { return Dict::class; } /** * Boot up the repository, pushing criteria. * * @throws \Prettus\Repository\Exceptions\RepositoryException */ public function boot() { $this->pushCriteria(app(RequestCriteria::class)); } /** * @return mixed */ public function searchDictsByPage() { return $this->paginate(request('per_page', 15)); } /** * @param $id * * @return mixed */ public function searchDictBy($id) { return $this->find($id); } /** * 通过key获取配置项 * @param $keys * @return mixed */ public function byKeysConfigs($keys) { return $this->whereIn('code', $keys)->with(['detail' => function ($query) { return $query->where('status', ModelStatusEnum::OK)->orderByDesc('sort')->select(['id', 'name', 'value', 'dict_id']); }])->select(['id', 'name', 'code'])->get(); } /** * 获取单个key * @param $key * @return mixed */ public function byKeysConfig($key) { return $this->where('code', $key)->with(['detail' => function ($query) { return $query->where('status', ModelStatusEnum::OK)->orderByDesc('sort')->select(['id', 'name', 'value', 'dict_id']); }])->select(['id', 'name', 'code'])->first(); } }