/** * Creates a new StatVisit model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new StatVisit(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->id]); } else { return $this->render('create', ['model' => $model]); } }
public function insertNewVisitor($params) { $model = new StatVisit(); $model->load(['StatVisit' => $params]); if (!$model->save()) { echo "StatVisit"; print_r($model->errors); } return $model; }
public function tracker() { $idvisitor = $this->getIdvisitor(); if (!($model = $this->findVisitor($idvisitor))) { $model = new StatVisit(); } $referrers = new Referrers(); $details = $referrers->getReferrerInformationFromRequest(); $model->load(['StatVisit' => $this->load($idvisitor, $details)]); $model->save(); if ($model->id) { $details['vid'] = $model->id; $details['flag'] = \yii::$app->request->get('rf', 1); $this->insertVisitDetails($details); } }