Пример #1
0
 public function isFollowing($userId)
 {
     return FeedFollower::model()->exists('user_id = :user_id && feed_id = :feed_id', array(':user_id' => $userId, ':feed_id' => $this->id));
 }
Пример #2
0
 public function actionUnfollow($id)
 {
     $feed = $this->loadModel($id);
     $feedFollower = FeedFollower::model()->findByAttributes(array('user_id' => Yii::app()->user->id, 'feed_id' => $feed->id));
     echo function_exists('json_encode') ? json_encode(!$feedFollower || $feedFollower->delete()) : CJSON::encode(!$feedFollower || $feedFollower->delete());
 }