/** * Страница просмотра события */ public function actionView($id) { \Yii::$app->user->setReturnUrl(['event/view', 'id' => $id]); $event = Event::find()->checkSubscribe()->where(['event.id' => $id])->one(); if (!$event) { throw new NotFoundHttpException(); } EventShow::showed($event); if (\Yii::$app->request->isAjax) { return $this->renderPartial('/event/view-info.php', ['event' => $event]); } return $this->render('view', ['event' => $event]); }
/** * @return EventQuery */ public function getShows() { return $this->hasMany(EventShow::className(), ['event_id' => 'id']); }