public function loadRelFor(Models $models, $relName, $flags = null)
    {
        $rel = $this->getRelOrError($relName);

        $foreign = $rel->loadModelsIfAvailable($models, $flags);

        $rel->linkModels($models, $foreign, function (AbstractLink $link) {
            $class = get_class($link->getModel());
            $class::getRepo()->addLink($link);
        });

        return $foreign;
    }
public function loadRelFor(Models $models, $relName, $flags = null)
    {
        $rel = $this->getRelOrError($relName);

        $foreign = $rel->loadModelsIfAvailable($models, $flags);

        $rel->linkModels($models, $foreign, function (AbstractLink $link) {
            $class = get_class($link->getModel());
            $class::getRepo()->addLink($link);
        });

        return $foreign;
    }
public function loadRelFor ( Models $ models , $ relName , $ flags = null ) { $ rel = $ this -> getRelOrError ( $ relName ) ; $ foreign = $ rel -> loadModelsIfAvailable ( $ models , $ flags ) ; $ rel -> linkModels ( $ models , $ foreign , function ( AbstractLink $ link ) { $ class = get_class ( $ link -> getModel ( ) ) ; $ class :: getRepo ( ) -> addLink ( $ link ) ; } ) ; return $ foreign ; }
Load models for a given relation.

@param  Models                   $models
@param  string                   $relName
@return Models
@throws InvalidArgumentException If $relName does not belong to repo
Load models for a given relation .