Beispiel #1
0
 /**
  * @param $id
  * @return $this|bool
  * @throws NotFoundHttpException
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     return $this->controller->render($this->viewFile, ['model' => $dataLogForm]);
 }
 /**
  * @param $id
  * @return $this|bool
  * @throws NotFoundHttpException
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     if ($dataLogForm->rollback()) {
         Yii::$app->session->setFlash('success', 'Успешно применено!');
     } else {
         Yii::$app->session->setFlash('error', 'Ошибка при откате записи!');
     }
     if (!Yii::$app->request->isAjax) {
         return $this->controller->redirect($this->redirectUrl);
     }
     return true;
 }
 /**
  * @param $id
  * @return $this
  * @throws NotFoundHttpException
  * @throws \Exception
  */
 public function run($id)
 {
     /** @var DataLogForm $dataLogForm */
     $dataLogForm = DataLogForm::findOne(['id' => $id]);
     if (empty($dataLogForm)) {
         throw new NotFoundHttpException('Лог не найден!');
     }
     if ($dataLogForm->delete()) {
         Yii::$app->session->setFlash('success', 'Лог удален!');
     } else {
         Yii::$app->session->setFlash('error', 'Ошибка удаления лога!');
     }
     if (!Yii::$app->request->isAjax) {
         return $this->controller->redirect($this->redirectUrl);
     }
     return true;
 }