public function whereHas($relation, array $where = [], array $whereHas = [], array $with = [])
    {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        $query = $query->whereHas($relation, function ($q) use ($whereHas) {
            $this->applyWhere($q, $whereHas);
        });

        return $query->get();
    }
public function whereHas($relation, array $where = [], array $whereHas = [], array $with = [])
    {
        $query = $this->make($with);

        $query = $this->applyWhere($query, $where);

        $query = $query->whereHas($relation, function ($q) use ($whereHas) {
            $this->applyWhere($q, $whereHas);
        });

        return $query->get();
    }
public function whereHas ( $ relation , array $ where = [ ] , array $ whereHas = [ ] , array $ with = [ ] ) { $ query = $ this -> make ( $ with ) ; $ query = $ this -> applyWhere ( $ query , $ where ) ; $ query = $ query -> whereHas ( $ relation , function ( $ q ) use ( $ whereHas ) { $ this -> applyWhere ( $ q , $ whereHas ) ; } ) ; return $ query -> get ( ) ; }
Return all results that have a required relationship with input constraints.

@param string $relation
@param array $where
@param array $whereHas
@param array $with

@return Collection
Return all results that have a required relationship with input constraints .