/** * Lists all StatVisitDetails models. * @return mixed */ public function actionIndex() { $searchModel = new StatVisitDetailsSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $idvisitor = ''; if ($searchModel->vid) { $model = StatVisit::findOne($searchModel->vid); if ($model) { $idvisitor = $model->idvisitor; } } return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'idvisitor' => $idvisitor]); }
/** * Finds the StatVisit model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StatVisit the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StatVisit::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }