Ejemplo n.º 1
0
 public function actionDelete($id)
 {
     $request = \Yii::$app->request;
     $ajax = $request->isAjax;
     if (!\app\helpers\Csrf::check()) {
         return $ajax ? json_encode(['success' => false]) : $this->goHome();
     }
     Model::directDelete($id);
     return $ajax ? json_encode(['success' => true]) : $this->redirect(static::URL_TO_INDEX);
 }