/** * Creates a new Analytics model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Analytics(); if ($model->load(Yii::$app->request->post()) && $model->save()) { return $this->redirect(['view', 'id' => $model->idanalytics]); } else { return $this->render('create', ['model' => $model]); } }
public function perform() { $ip = $this->args['ip']; $browser = $this->args['browser']; $url = $this->args['url']; $iduser = $this->args['iduser']; $session = $this->args['session']; $model = new Analytics(); $model->url = $url; $model->ip = $ip; $model->iduser = $iduser ? $iduser : '******'; $model->session = $session; $model->browser = $browser; $model->cdate = DATE_RFC3339; if ($model->save()) { echo "Saved Successfully!"; } else { print_r($model->getErrors()); } //echo "<pre>";print_r($model->attributes); # Run task }