Vishal Singh
Vishal Singh

Reputation: 19

Get following users feed

I am trying to get all activites of the users whom I am following i.e.

Suppose I am following two users A and B, so I want all activities of these useres.

I have done following (laravel framework) :

suppose my id is $user_id and user whom I am following have id $target_id

To follow user I used following :

\FeedManager::followUser($user_id, $target_id);
// following  flat feed of user whom I am following
$followFlatFeed = \FeedManager::getClient()->feed('flat', $target_id);
// following user feed
$followFlatFeed->followFeed('user', $user_id);

To get the all feeds of following user I have used following code:

$feed = \FeedManager::getNewsFeeds($user_id)['flat'];
$activities = $feed->getActivities(0, 1000);

But I am getting only my own feeds not for the user whom I following

Upvotes: 1

Views: 181

Answers (1)

Matthisk
Matthisk

Reputation: 1521

The example above will create the reversed follow relation of $target_id -> follows -> $user_id. If I understand you correctly you want the follow relationship $user_id -> follows -> $target_id.

Upvotes: 1

Related Questions