src/Traits/WorksWithRelations.php
protected function updateOrCreateHasOne(array $fillable, Model $model, Relation $relation)
    {
        $id = '';

        if (array_key_exists('id', $fillable)) {
            $id = $fillable['id'];
        }

        if (array_except($fillable, ['id'])) {
            if (property_exists($this, 'pruneHasOne') && $this->pruneHasOne !== false) {
                $relation->update($fillable);
            }

            return $relation->updateOrCreate(['id' => $id], $fillable);
        }

        return null;
    }
protected function updateOrCreateHasOne(array $fillable, Model $model, Relation $relation)
    {
        $id = '';

        if (array_key_exists('id', $fillable)) {
            $id = $fillable['id'];
        }

        if (array_except($fillable, ['id'])) {
            if (property_exists($this, 'pruneHasOne') && $this->pruneHasOne !== false) {
                $relation->update($fillable);
            }

            return $relation->updateOrCreate(['id' => $id], $fillable);
        }

        return null;
    }
protected function updateOrCreateHasOne ( array $ fillable , Model $ model , Relation $ relation ) { $ id = '' ; if ( array_key_exists ( 'id' , $ fillable ) ) { $ id = $ fillable [ 'id' ] ; } if ( array_except ( $ fillable , [ 'id' ] ) ) { if ( property_exists ( $ this , 'pruneHasOne' ) && $ this -> pruneHasOne !== false ) { $ relation -> update ( $ fillable ) ; } return $ relation -> updateOrCreate ( [ 'id' => $ id ] , $ fillable ) ; } return null ; }
HasOne relation updateOrCreate logic.

@param array    $fillable The relation fillable.
@param Model    $model    The eloquent model.
@param Relation $relation The eloquent relation.

@return Model | null
HasOne relation updateOrCreate logic .