src/Database/AbstractModel.php
public function getAttribute($key)
    {
        if (! is_null($value = parent::getAttribute($key))) {
            return $value;
        }

        // If a custom relation with this key has been set up, then we will load
        // and return results from the query and hydrate the relationship's
        // value on the "relationships" array.
        if (! $this->relationLoaded($key) && ($relation = $this->getCustomRelation($key))) {
            if (! $relation instanceof Relation) {
                throw new LogicException(
                    'Relationship method must return an object of type '.Relation::class
                );
            }

            return $this->relations[$key] = $relation->getResults();
        }
    }
public function getAttribute($key)
    {
        if (! is_null($value = parent::getAttribute($key))) {
            return $value;
        }

        // If a custom relation with this key has been set up, then we will load
        // and return results from the query and hydrate the relationship's
        // value on the "relationships" array.
        if (! $this->relationLoaded($key) && ($relation = $this->getCustomRelation($key))) {
            if (! $relation instanceof Relation) {
                throw new LogicException(
                    'Relationship method must return an object of type '.Relation::class
                );
            }

            return $this->relations[$key] = $relation->getResults();
        }
    }
public function getAttribute ( $ key ) { if ( ! is_null ( $ value = parent :: getAttribute ( $ key ) ) ) { return $ value ; } // If a custom relation with this key has been set up, then we will load // and return results from the query and hydrate the relationship's // value on the "relationships" array. if ( ! $ this -> relationLoaded ( $ key ) && ( $ relation = $ this -> getCustomRelation ( $ key ) ) ) { if ( ! $ relation instanceof Relation ) { throw new LogicException ( 'Relationship method must return an object of type ' . Relation :: class ) ; } return $ this -> relations [ $ key ] = $ relation -> getResults ( ) ; } }
Get an attribute from the model. If nothing is found, attempt to load
a custom relation method with this key.

@param string $key
@return mixed
Get an attribute from the model . If nothing is found attempt to load a custom relation method with this key .