/** * Creates a new Twitter model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model = new Twitter(); 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 add($moment_id, $tweet_id, $twitter_id, $screen_name, $tweeted_at, $text) { if (!Twitter::find()->where(['moment_id' => $moment_id])->andWhere(['tweet_id' => $tweet_id])->exists()) { $i = new Twitter(); $i->moment_id = $moment_id; $i->tweet_id = $tweet_id; $i->twitter_id = $twitter_id; $i->screen_name = $screen_name; $i->tweeted_at = $tweeted_at; $i->text = $text; $i->save(); } }