Пример #1
0
 public function actionMore($id)
 {
     $model = new CommentForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $comment = $model->addComment($id);
         if (!$comment) {
             Yii::$app->session->setFlash('error', 'Ошибка при валидации');
             Yii::error('Ошибка при валидации');
             return $this->refresh();
         }
     }
     $tour = Tour::findOne($id);
     //->all();
     $gallery = Gallery::find()->where(['id_tour' => $id])->all();
     $comments = $model->getComments($id);
     return $this->render('more', ['tour' => $tour, 'gallery' => $gallery, 'model' => $model, 'comments' => $comments]);
 }