request = $request; } /** * @param $model * @param RepositoryInterface $repository * * @return mixed */ public function apply($model, RepositoryInterface $repository) { if ($this->request->filled('name')) { $model = $model->where('name', 'like', '%' . $this->request->get('name') . '%'); } if ($this->request->filled('tag')) { $model = $model->where('tag', '=', $this->request->get('tag')); } if ($this->request->filled('code')) { $model = $model->where('code', 'like', $this->request->get('code') . '%'); } if ($this->request->filled('is_system')) { $model = $model->where('is_system', '=', $this->request->get('is_system')); } return $model; } }