Ejemplo n.º 1
0
 public function actionDelete($id, $type = null)
 {
     // Find Model
     $model = GalleryService::findById($id);
     // Delete/Render if exist
     if (isset($model)) {
         $model->type = $type;
         if ($model->load(Yii::$app->request->post(), 'Gallery')) {
             if (GalleryService::delete($model)) {
                 $this->redirect($this->returnUrl);
             }
         }
         return $this->render('@cmsgears/module-core/admin/views/gallery/delete', ['model' => $model]);
     }
     // Model not found
     throw new NotFoundHttpException(Yii::$app->cmgCoreMessage->getMessage(CoreGlobal::ERROR_NOT_FOUND));
 }