stream-laravel
stream-laravel copied to clipboard
adding to diffrent feeds
I know that when you create a new post, it adds to the user feed by default. When the post is created, I also want to add it to certin categories. For instance, if the post they are creating is under under catifgory X, I want to add to the feed of category X. This way peopel can follows categories. How would I do this? Thank you.
Ha, I'm trying to figure out the same thing and it's really unclear. I can only see information about doing that manually.
You can do this with the activity to
targeting field. If you use the activity trait you can get that done by implementing the activityNotify
method and return the list of feeds the activity should be copied.
public function activityNotify()
{
if (...) {
return ['category:1', 'category:2', ...];
}
}
@tbarbugli thanks - I had figured this out after writing the comment. What's still remains unclear to me is whether this should be a second activity add being fired, or if it should be on the initial one where it's added to the user timeline? I'm firing two activity add events, setting the foreign keys on both, but seeing duplicates when the user subscribes to follow both a user and category.