/** * Updates an existing Sport model. * If update is successful, the browser will be redirected to the 'view' page. * @param string $url_key * @return mixed */ public function actionUpdate($url_key) { $model = $this->findModel(['url_key' => $url_key]); $eventSearchModel = new EventSearch(); $eventDataProvider = $eventSearchModel->searchBySportUrlKey(Yii::$app->request->queryParams, $url_key); $eventsSetSearchModel = new EventsSetSearch(); $eventsSetDataProvider = $eventsSetSearchModel->searchBySportUrlKey(Yii::$app->request->queryParams, $url_key); if ($model->load(Yii::$app->request->post()) && $model->save()) { Yii::$app->session->setFlash('success', Yii::t('app', 'Changes were been successfully saved')); return $this->redirect(['sport/index']); } else { return $this->render('update', ['model' => $model, 'eventSearchModel' => $eventSearchModel, 'eventDataProvider' => $eventDataProvider, 'eventsSetSearchModel' => $eventsSetSearchModel, 'eventsSetDataProvider' => $eventsSetDataProvider]); } }
/** * Lists all Event models. * @return mixed */ public function actionIndex() { $searchModel = new EventSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }