protected function updateRelation($eloquentModel, $name, $relationMapping, $action)
    {
        // set foreign key for belongsTo/morphTo relation
        if ($relationMapping['type'] == 'belongsTo' || $relationMapping['type'] == 'morphTo') {
            $this->updateBelongsToRelation($eloquentModel, $name, $action);
        }

        // set foreign keys for belongsToMany/morphToMany relation
        if (($relationMapping['type'] == 'belongsToMany' || $relationMapping['type'] == 'morphToMany') && ! $relationMapping['inverse']) {
            $this->updateBelongsToManyRelation($eloquentModel, $name, $action);
        }
    }
protected function updateRelation($eloquentModel, $name, $relationMapping, $action)
    {
        // set foreign key for belongsTo/morphTo relation
        if ($relationMapping['type'] == 'belongsTo' || $relationMapping['type'] == 'morphTo') {
            $this->updateBelongsToRelation($eloquentModel, $name, $action);
        }

        // set foreign keys for belongsToMany/morphToMany relation
        if (($relationMapping['type'] == 'belongsToMany' || $relationMapping['type'] == 'morphToMany') && ! $relationMapping['inverse']) {
            $this->updateBelongsToManyRelation($eloquentModel, $name, $action);
        }
    }
protected function updateRelation ( $ eloquentModel , $ name , $ relationMapping , $ action ) { // set foreign key for belongsTo/morphTo relation if ( $ relationMapping [ 'type' ] == 'belongsTo' || $ relationMapping [ 'type' ] == 'morphTo' ) { $ this -> updateBelongsToRelation ( $ eloquentModel , $ name , $ action ) ; } // set foreign keys for belongsToMany/morphToMany relation if ( ( $ relationMapping [ 'type' ] == 'belongsToMany' || $ relationMapping [ 'type' ] == 'morphToMany' ) && ! $ relationMapping [ 'inverse' ] ) { $ this -> updateBelongsToManyRelation ( $ eloquentModel , $ name , $ action ) ; } }
Update a relation.

@param \ProAI\Datamapper\Eloquent\Model $eloquentModel
@param string $name
@param array $relationMapping
@param string $action
@return void
Update a relation .