public function updateOrCreate(array $attributes, array $updateAttributes)
    {
        $model = $this->get($attributes);
        if (null === $model) {
            $model = $this->getModel()->create();
            $model->setIsNewRecord(true);
        }

        $model->setAttributes($updateAttributes);
        if ($model->save()) {
            return $model;
        }

        return false;
    }
public function updateOrCreate(array $attributes, array $updateAttributes)
    {
        $model = $this->get($attributes);
        if (null === $model) {
            $model = $this->getModel()->create();
            $model->setIsNewRecord(true);
        }

        $model->setAttributes($updateAttributes);
        if ($model->save()) {
            return $model;
        }

        return false;
    }
public function updateOrCreate ( array $ attributes , array $ updateAttributes ) { $ model = $ this -> get ( $ attributes ) ; if ( null === $ model ) { $ model = $ this -> getModel ( ) -> create ( ) ; $ model -> setIsNewRecord ( true ) ; } $ model -> setAttributes ( $ updateAttributes ) ; if ( $ model -> save ( ) ) { return $ model ; } return false ; }
Find and update model if exists. Else create model.

@param array $attributes
@param array $updateAttributes

@throws MultipleObjectsReturned

@return ModelInterface|bool
Find and update model if exists . Else create model .