controllers/AdminController.php
public function actionDeleteImage($id)
    {
        $model = $this->module->manager->findGalleryImageById($id);
        if ($model === null) {
            throw new NotFoundHttpException('The requested page does not exist');
        }

        $model->delete();

        \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been deleted'));

        return $this->redirect(['images', 'id' => $model->gallery_id]);
    }
public function actionDeleteImage($id)
    {
        $model = $this->module->manager->findGalleryImageById($id);
        if ($model === null) {
            throw new NotFoundHttpException('The requested page does not exist');
        }

        $model->delete();

        \Yii::$app->getSession()->setFlash('gallery.success', \Yii::t('gallery', 'Image has been deleted'));

        return $this->redirect(['images', 'id' => $model->gallery_id]);
    }
public function actionDeleteImage ( $ id ) { $ model = $ this -> module -> manager -> findGalleryImageById ( $ id ) ; if ( $ model === null ) { throw new NotFoundHttpException ( 'The requested page does not exist' ) ; } $ model -> delete ( ) ; \ Yii :: $ app -> getSession ( ) -> setFlash ( 'gallery.success' , \ Yii :: t ( 'gallery' , 'Image has been deleted' ) ) ; return $ this -> redirect ( [ 'images' , 'id' => $ model -> gallery_id ] ) ; }
Deletes an existing GalleryImage model.
If deletion is successful, the browser will be redirected to the 'images' page.

@param  integer $id
@return \yii\web\Response
@throws NotFoundHttpException
@throws \Exception
Deletes an existing GalleryImage model . If deletion is successful the browser will be redirected to the images page .