protected function callRelationship($name)
    {
        // Get the relationship arguments
        $args = $this->getRelationship($name);

        // Build the relationship
        $method = array_shift($args);
        $relationship = call_user_func_array([$this, $method], $args);

        // Check to see if this relationship has extended pivot attributes
        if ($this->hasPivotAttributes($name)) {
            // Add timestamps to relationship
            $attributes = $this->getPivotAttributes($name);
            if (in_array('timestamps', $attributes)) {
                unset($attributes[array_search('timestamps', $attributes)]);
                $relationship->withTimestamps();
            }

            // Add the pivot attributes to the relationship
            $relationship->withPivot($attributes);
        }

        return $relationship;
    }
protected function callRelationship($name)
    {
        // Get the relationship arguments
        $args = $this->getRelationship($name);

        // Build the relationship
        $method = array_shift($args);
        $relationship = call_user_func_array([$this, $method], $args);

        // Check to see if this relationship has extended pivot attributes
        if ($this->hasPivotAttributes($name)) {
            // Add timestamps to relationship
            $attributes = $this->getPivotAttributes($name);
            if (in_array('timestamps', $attributes)) {
                unset($attributes[array_search('timestamps', $attributes)]);
                $relationship->withTimestamps();
            }

            // Add the pivot attributes to the relationship
            $relationship->withPivot($attributes);
        }

        return $relationship;
    }
protected function callRelationship ( $ name ) { // Get the relationship arguments $ args = $ this -> getRelationship ( $ name ) ; // Build the relationship $ method = array_shift ( $ args ) ; $ relationship = call_user_func_array ( [ $ this , $ method ] , $ args ) ; // Check to see if this relationship has extended pivot attributes if ( $ this -> hasPivotAttributes ( $ name ) ) { // Add timestamps to relationship $ attributes = $ this -> getPivotAttributes ( $ name ) ; if ( in_array ( 'timestamps' , $ attributes ) ) { unset ( $ attributes [ array_search ( 'timestamps' , $ attributes ) ] ) ; $ relationship -> withTimestamps ( ) ; } // Add the pivot attributes to the relationship $ relationship -> withPivot ( $ attributes ) ; } return $ relationship ; }
Proxy call a relationship method using the
configuration arguments of the relationship.

@param string $name of related model

@return mixed
Proxy call a relationship method using the configuration arguments of the relationship .