示例#1
0
 /**
  * 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]);
     }
 }
示例#2
0
文件: Twitter.php 项目: smbale/eyew
 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();
     }
 }