request = $request; } /** * @param $model * @param RepositoryInterface $repository * * @return mixed */ public function apply($model, RepositoryInterface $repository) { // this is a Example //if ($this->request->filled('name')) { // $model = $model->where('name', '=', $this->request->get('name')); //} if ($this->request->filled('type')) { $type = $this->request->get('type'); $model = $model->where('type', '=', $type); } return $model; } }