Illuminate\Database\Eloquent\Builder::loadRelation PHP Метод

loadRelation() защищенный Метод

Eagerly load the relationship on a set of models.
protected loadRelation ( array $models, string $name, Closure $constraints ) : array
$models array
$name string
$constraints Closure
Результат array
    protected function loadRelation(array $models, $name, Closure $constraints)
    {
        // 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($models);
        call_user_func($constraints, $relation);
        $models = $relation->initRelation($models, $name);
        // 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.
        $results = $relation->getEager();
        return $relation->match($models, $results, $name);
    }