request = $request; } /** * @inheritDoc */ public function apply($model, RepositoryInterface $repository) { if ($name = $this->request->get('name', false)) { $model = $model->where('name', 'like', "%{$name}%"); } if ($this->request->filled('shop_id')) { $shop_id = $this->request->get('shop_id'); $model = $model->where('shop_ids', 'like', "-{$shop_id}-"); } if ($this->request->filled('type')) { $type = $this->request->get('type'); $model = $model->where('type', $type); } if ($status = $this->request->get('status', ModelStatusEnum::OK)) { $model = $model->where('status', $status); } // $model = $model->orderByDesc("id"); return parent::apply($model, $repository); } }