/** * Lists all TourField models. * @return mixed */ public function actionIndex() { $params = Yii::$app->request->queryParams; if (empty($params['TourFieldSearch']['tour_id'])) { $params['TourFieldSearch']['tour_id'] = Tour::find()->one()->id; } $searchModel = new TourFieldSearch(); $dataProvider = $searchModel->search($params); $dataProvider->pagination->setPageSize(-1); $dataProvider->sort = false; $tour = Tour::findOne(['id' => $searchModel->tour_id]); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'tour' => $tour]); }
/** * Finds the Tour model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Tour the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Tour::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }