protected function addOrGetRelated($key)
    {
        $related = $this->relatedValues->get($key) ?? $this->getFreshModelForElements();

        if (! $related->exists && ! $this->exceedsLimit()) {
            $this->relatedValues->put($key, $related);
        }

        return $related;
    }
protected function addOrGetRelated($key)
    {
        $related = $this->relatedValues->get($key) ?? $this->getFreshModelForElements();

        if (! $related->exists && ! $this->exceedsLimit()) {
            $this->relatedValues->put($key, $related);
        }

        return $related;
    }
protected function addOrGetRelated ( $ key ) { $ related = $ this -> relatedValues -> get ( $ key ) ?? $ this -> getFreshModelForElements ( ) ; if ( ! $ related -> exists && ! $ this -> exceedsLimit ( ) ) { $ this -> relatedValues -> put ( $ key , $ related ) ; } return $ related ; }
Appends fresh related model if total count is not exceeding limit.

@param $key

@return $this
Appends fresh related model if total count is not exceeding limit .