public function actionDeleteImage($id) {
        if (!empty($id)) {
            $paymentMethod = PaymentMethod::findOne($id);

            $isDeleted = \Yii::$app->shop_imagable->delete('payment', $paymentMethod->image);

            if ($isDeleted) {
                $paymentMethod->image = NULL;
                $paymentMethod->save();
                return $this->redirect(Yii::$app->request->referrer);
            }
            else throw new Exception('Deleting failed.');
        }
        else throw new NotFoundHttpException();
    }
public function actionDeleteImage($id) {
        if (!empty($id)) {
            $paymentMethod = PaymentMethod::findOne($id);

            $isDeleted = \Yii::$app->shop_imagable->delete('payment', $paymentMethod->image);

            if ($isDeleted) {
                $paymentMethod->image = NULL;
                $paymentMethod->save();
                return $this->redirect(Yii::$app->request->referrer);
            }
            else throw new Exception('Deleting failed.');
        }
        else throw new NotFoundHttpException();
    }
public function actionDeleteImage ( $ id ) { if ( ! empty ( $ id ) ) { $ paymentMethod = PaymentMethod :: findOne ( $ id ) ; $ isDeleted = \ Yii :: $ app -> shop_imagable -> delete ( 'payment' , $ paymentMethod -> image ) ; if ( $ isDeleted ) { $ paymentMethod -> image = NULL ; $ paymentMethod -> save ( ) ; return $ this -> redirect ( Yii :: $ app -> request -> referrer ) ; } else throw new Exception ( 'Deleting failed.' ) ; } else throw new NotFoundHttpException ( ) ; }
Deletes image from Payment method model.

@param integer $id
@return mixed
@throws NotFoundHttpException
@throws Exception
Deletes image from Payment method model .