src/Eloquent/BaseRepository.php
public function applyCriteria($criteria)
    {
        $query = $this->getQuery();

        if($criteria instanceof Criteria){
            $criteria->apply($query);

            return $this;
        }

        if($criteria instanceof Closure){
            $criteria($query);

            return $this;
        }

        throw new RepositoryException("Must be an instance of " . Criteria::class . " or \\Closure");
    }
public function applyCriteria($criteria)
    {
        $query = $this->getQuery();

        if($criteria instanceof Criteria){
            $criteria->apply($query);

            return $this;
        }

        if($criteria instanceof Closure){
            $criteria($query);

            return $this;
        }

        throw new RepositoryException("Must be an instance of " . Criteria::class . " or \\Closure");
    }
Apply a query

@param Criteria|Closure $criteria
@return mixed
@throws \Exception