protected function loadRelation(array $results, string $name, Closure $constraints) : array
    {
        // First we will "back up" the existing where conditions on the query so we can
        // add our eager constraints. Then we will merge the wheres that were on the
        // query back to it in order that any where conditions might be specified.
        $relation = $this->getRelation($name);

        $relation->addEagerConstraints($results);

        call_user_func($constraints, $relation);

        // Once we have the results, we just match those back up to their parent models
        // using the relationship instance. Then we just return the finished arrays
        // of models which have been eagerly hydrated and are readied for return.
        return $relation->match($results, $name);
    }
protected function loadRelation(array $results, string $name, Closure $constraints) : array
    {
        // First we will "back up" the existing where conditions on the query so we can
        // add our eager constraints. Then we will merge the wheres that were on the
        // query back to it in order that any where conditions might be specified.
        $relation = $this->getRelation($name);

        $relation->addEagerConstraints($results);

        call_user_func($constraints, $relation);

        // Once we have the results, we just match those back up to their parent models
        // using the relationship instance. Then we just return the finished arrays
        // of models which have been eagerly hydrated and are readied for return.
        return $relation->match($results, $name);
    }
protected function loadRelation ( array $ results , string $ name , Closure $ constraints ) : array { // First we will "back up" the existing where conditions on the query so we can // add our eager constraints. Then we will merge the wheres that were on the // query back to it in order that any where conditions might be specified. $ relation = $ this -> getRelation ( $ name ) ; $ relation -> addEagerConstraints ( $ results ) ; call_user_func ( $ constraints , $ relation ) ; // Once we have the results, we just match those back up to their parent models // using the relationship instance. Then we just return the finished arrays // of models which have been eagerly hydrated and are readied for return. return $ relation -> match ( $ results , $ name ) ; }
Eagerly load the relationship on a set of entities.

@param array    $results
@param string   $name
@param \Closure $constraints

@return array
Eagerly load the relationship on a set of entities .