request = $request; $this->where = $where; } /** * Apply criteria in query repository * * @param Builder|Model $model * @param RepositoryInterface $repository * * @return mixed * @throws \Exception */ public function apply($model, RepositoryInterface $repository) { if($this->where) { $model = $model->where($this->where); } return $model; } }