getstream / stream-laravel Goto Github PK
View Code? Open in Web Editor NEWLaravel Client - Build Activity Feeds & Streams with GetStream.io
Home Page: https://getstream.io
License: BSD 3-Clause "New" or "Revised" License
Laravel Client - Build Activity Feeds & Streams with GetStream.io
Home Page: https://getstream.io
License: BSD 3-Clause "New" or "Revised" License
Hi
Using this package how would we accomplish batch follows ?
I'm using L5.3 and one of the main packages is using firebase 2.2.0 (Passport) to be exact.
Is there a way to get this package to support this so we can install it properly.
Problem 1
- Installation request for get-stream/stream-laravel ~2.2.6 -> satisfiable by get-stream/stream-laravel[2.2.6].
- Conclusion: don't install firebase/php-jwt v2.2.0
- get-stream/stream-laravel 2.2.6 requires get-stream/stream ~2.2 -> satisfiable by get-stream/stream[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.2.4, 2.2.5, 2.2.6, 2.2.7, 2.2.8].
- get-stream/stream 2.2.0 requires firebase/php-jwt 2.1.* -> satisfiable by firebase/php-jwt[v2.1.0].
- get-stream/stream 2.2.1 requires firebase/php-jwt 2.1.* -> satisfiable by firebase/php-jwt[v2.1.0].
- get-stream/stream 2.2.2 requires firebase/php-jwt 2.1.* -> satisfiable by firebase/php-jwt[v2.1.0].
- get-stream/stream 2.2.3 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- get-stream/stream 2.2.4 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- get-stream/stream 2.2.5 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- get-stream/stream 2.2.6 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- get-stream/stream 2.2.7 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- get-stream/stream 2.2.8 requires firebase/php-jwt ^2.1 -> satisfiable by firebase/php-jwt[v2.1.0, v2.2.0].
- Conclusion: don't install firebase/php-jwt v2.1.0|install firebase/php-jwt v2.2.0
Hi guys,
Is there a way to get timeline feeds by activity? My timeline seems to include following, likes, and comment activities. I would like to make it work like the sample found in GetStream's homepage (the interactive demo), where homepage shows posts from followed users only and another page shows aggregated feed. Should I filter it myself? like:
if (activity verb == 'likes' or 'following' or 'comment') {
//do nothing
} else {
//add to display list
}
thanks. nice project by the way. God bless.
In the demo project, I found that the timeline
group only includes tasks posted by people I followed, is that means if I want to get task posted by me and people I followed I must use user
group?
after running
php artisan vendor:publish --provider="GetStream\StreamLaravel\StreamLaravelServiceProvider"
i get this error
[ReflectionException]
Class files does not exist
and the config/stream-laravel.php does not creating.
anyone experienaced this?
root@ns371466:/var/www/html# composer require get-stream/stream-laravel
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^2.2 for get-stream/stream-laravel
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 4 installs, 0 updates, 0 removals
- Installing 99designs/http-signatures (2.0.5): Downloading (100%)
- Installing firebase/php-jwt (v4.0.0): Downloading (100%)
- Installing get-stream/stream (2.3.0): Downloading (100%)
- Installing get-stream/stream-laravel (2.2.7): Downloading (100%)
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
The compiled services file has been removed.
root@ns371466:/var/www/html# php artisan vendor:publish --provider="GetStream\StreamLaravel\StreamLaravelServiceProvider"
Publishing complete.
root@ns371466:/var/www/html#
It says publishing complete yet I see no config/stream-laravel.php file
Running Laravel 5.4 and PHP7.0
I tried overloading the above method to a different feed than user as below. But still the streaming was happening to the user feed until I changed the config.php user_feed to notification
public function activityAuthorFeed()
{
return 'notification';
}
Laravel 5 has been released, and my mistake, when i try to install it via composer with Laravel 5 i get the following error
- get-stream/stream-laravel 2.1.1 requires illuminate/database 4.2.* -> sati sfiable by illuminate/database[v4.2.1, v4.2.12, v4.2.16, v4.2.2, v4.2.3, v4.2.4, v4.2.5, v4.2.6, v4.2.7, v4.2.8, v4.2.9].
Will any updates will be available in the future?
Thank you
In my newly installed laravel 5.4 application, running php artisan vendor:publish --provider="GetStream\StreamLaravel\StreamLaravelServiceProvider"
gets
[Symfony\Component\Debug\Exception\FatalThrowableError]
Call to undefined method Illuminate\Foundation\Application::share()
https://laravel.com/docs/5.4/upgrade
share Method Removed
Laravel 5.4.28, stream-laravel 2.2.8, stream-php 2.5.0.
A while ago my activity feeds stopped working and they kind of just got forgotten about. I'm coming back to it, and I've found:
Model::create()
, it calls Model::newInstance()
. I've tried directly calling MyModel::create()
to see if the trait gets triggered, but it doesn't.I've tried making a new app within get-stream, no success. If I manually push the activity within my model boot function, it works:
public static function boot()
{
static::created(function ($model) {
$manager = \App::make('feed_manager');
$manager->activityCreated($model);
});
}
This is an okay workaround for me personally, as I only have a handful of activity actions, but I really wouldn't want to do this if my models were any more complicated than a bridge between a user and an object. This also works when using Model::newInstance()
, so I can only assume the issue lies within the trait not booting properly.
We have a situation where we would only want to add a model to a feed based on if the model has a certain property or not. For example, I want to create a new blog post and mark it as either private or public. I only want that model to be added to my feed if I mark it as public.
Is that possible with this library?
Is there a way to send enriched activities via json? When I try to, the activities appear as empty objects. I can try to do this myself, but just wanted to know if this has been done before.
{"detail":"api_key is missing","status_code":401,"code":2,"exception":"ApiKeyException"}
I am getting the above error. Any ideas on how to fix it?
Trace:
in Feed.php line 102
at Feed->makeHttpRequest('feed/timeline/31/', 'GET', null, array('offset' => 0, 'limit' => 25, 'api_key' => null), 'feed', 'read') in BaseFeed.php line 201
at BaseFeed->getActivities(0, 25) in FeedsController.php line 15
at FeedsController->newsFeed(object(Request))
at call_user_func_array(array(object(FeedsController), 'newsFeed'), array(object(Request))) in Controller.php line 55
at Controller->callAction('newsFeed', array(object(Request))) in ControllerDispatcher.php line 44
at ControllerDispatcher->dispatch(object(Route), object(FeedsController), 'newsFeed') in Route.php line 203
at Route->runController() in Route.php line 160
at Route->run() in Router.php line 559
at Router->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing{closure}(object(Request)) in SubstituteBindings.php line 41
at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in Authenticate.php line 43
at Authenticate->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in VerifyCsrfToken.php line 65
at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in ShareErrorsFromSession.php line 49
at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in StartSession.php line 64
at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in EncryptCookies.php line 59
at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Router.php line 561
at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 520
at Router->dispatchToRoute(object(Request)) in Router.php line 498
at Router->dispatch(object(Request)) in Kernel.php line 174
at Kernel->Illuminate\Foundation\Http{closure}(object(Request)) in Pipeline.php line 30
at Pipeline->Illuminate\Routing{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 148
at Pipeline->Illuminate\Pipeline{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing{closure}(object(Request)) in Pipeline.php line 102
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 53
at require_once('C:\Users\KDAFES\Downloads\New folder\new\laravel-stream-master\public\index.php') in server.php line 21
Having trouble with the version 2.2 included here cause of old php-jwt package. Please update to latest SDK version.
Hi.
I'm getting the following error:
Argument 3 passed to GuzzleHttp\Client::request() must be of the type array, string given, called in /vagrant/quantofa/vendor/guzzlehttp/guzzle/src/Client.php on line 88 and defined
While trying to follow feeds or getActivities.
I'm using Laravel 5.
Thanks
If you follow the instructions you will get the error 'Trait not found'
Even if you're able to resolve that as I was it won't make any calls to the server
Hello,
ActivityTrait does not trigger if we have boot function in Model with static::created function.
protected static function boot()
{
parent::boot();
static::created(function($answer){
$answer->feeds()->create(['authorID' => $answer->authorID]);
});
}
So it looks like in the Docs that the activityLazyLoading
is defined as a method, but within the Enricher it is called as a property.
private function retrieveObjects($references)
{
$objects = array();
foreach ($references as $content_type => $content_ids) {
$content_type_model = new $content_type;
$with = array();
if (property_exists($content_type_model, 'activityLazyLoading')) {
$with = $content_type_model->activityLazyLoading;
}
$fetched = $this->fromDb($content_type_model, array_keys($content_ids), $with);
$objects[$content_type] = $fetched;
}
return $objects;
}
inside the CreateRemoveObserver.php
we have $manager = \App::make('feed_manager');
What's the purpose of this FeedManager?
I am trying to port this to CakePHP 3.x so I am trying to understand this.
Having a quick look over the code it doesn't look like you're using the app's queue in order to publish events to Stream. This means whenever a relevant model is created/updated/deleted the HTTP request to publish that to Stream is going to happen inline and slow down the request.
Are there any plans to support jobs/queue for this sort of publishing, or are you open to pull requests that would make this change?
In Pull Request #6 I changed the "withTrash" detection in fromDB() to use in_array on class methods available to detect the softDeletingTrait
in_array should be replaced by preg_grep to match on a reduced target trait name (rather than requiring the fully qualified trait path which is subject to change).
Quiz model uses GetStream\StreamLaravel\Eloquent\ActivityTrait.
When a new Quiz is created the stored feed has the following attributes:
The stored feed has the following attributes:
The most important attribute is "verb" and I assume it had to be correct for specific actions like create, update, delete.
Hi there
When trying to enrich my activities I get an empty object.
Here is the code in my controller:
$enricher = new Enrich;
$feed = FeedManager::getUserFeed($request->user()->id);
$activities = $feed->getActivities()['results'];
Log::debug('activity', [$activities]);
$activities = $enricher->enrichActivities($activities);
Log::error('enriched', [$activities]);
This is what I get in the log:
[2018-03-18 12:26:15] local.DEBUG: activity [[{"actor":"App\\Models\\User:1","foreign_id":"App\\Models\\Measurement:16","id":"19c0cd80-2aa0-11e8-8080-80003305d0b1","object":"App\\Models\\Measurement:16","origin":null,"target":"","time":"2018-03-18T11:32:55.000000","verb":"measurement"}]]
[2018-03-18 12:26:15] local.ERROR: enriched [["[object] (GetStream\\StreamLaravel\\EnrichedActivity: {})"]]
Note, I saw #51 and tried the solution suggested and have tried all of the following ways of calling Enrich $enricher = new Enrich
, $enricher = new Enrich()
and $enricher = new Enrich(['actor', 'object])
but none of the solves it for me.
I'm using Laravel 5.5.39 and 2.3.0 of this package.
Thanks in advance.
There are some firebase issues with a fresh installation of 5.6.
guys, what is the correct way of doing mass deletion?
i have a Post object that I want to delete, that has:
PostComments
PostMentions
PostLikes
PostReply
PostReplyMention
PostReplyLike
assuming each of these records can reach more or less a thousand records, should i manually iterate over them?
as I have noticed PostLikes::where("liker_id", Auth::id())->delete(); does not seem to work.
Hi!
Im using stream-laravel 2.2 for larval 5.4 and I keep getting:
local.ERROR: Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined method GetStream\StreamLaravel\StreamLaravelManager::addActivity() in /Users/homeboi/code/tree/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php:221
According to docs https://getstream.io/docs/php/#adding-activities, this is the workflow?
$data = [
'actor' => Auth::user()->id,
'verb' => 'favourited',
'object' => 'user',
];
\FeedManager::addActivity($data);
I have model that is set with custom activity method name. But it doesn't seem to work. It still shows as user which you set on stream-laravel.php config under user_feed.
How do we solve it?
Getting following above error in Laravel 5.3. Any idea how to fix it?
location is supported but not documented yet
Hello guys, I found little issue with extra data but it's cause by a reserved word, the word is time in my model has a field named like this and stream needed a specific format to time field, please update https://getstream.io/docs/php/#adding-activities section and add reserved word to recomendations
I rushed a little, later indicate it, sorry guys!
So I have a User model, which represents a user, unsurprisingly.
A user can befriend another user and view their feeds, that works fine. My issue is that I also have a Team model that a user can follow. This is how I make the activity for it a 'hosted event' that is bound to a Team.
$instance = app(CommunityHostedRepository::class)->create([
'team_id' => $event->eventable_id,
'event_id' => $event->id,
]);
The core issue here is that the activity in Stream gets pushed to the user:1
origin, so it only shows in the feeds for friends of user1, but not user2, who follows team1 and is not a friend of user1.
I went and removed the trait from my CommunityHosted model, and added the following:
$feed = FeedManager::getFeed('team', $event->eventable_id);
$feed->addActivity([
"actor" => Utils::createModelReference($instance->team),
"verb" => $instance->activityVerb(),
"object" => Utils::createModelReference($instance),
]);
And this works fine. It gets pushed to the team:1
origin and comes up on both user1 & user2's feeds. The foreign_id
isn't set, but I can still access the Eloquent model through $activity['object']
just fine.
My CommunityHosted model looks like so:
class CommunityHosted extends Model implements Transformable
{
use TransformableTrait, ActivityTrait;
protected $table = 'activity_communityhosted';
protected $fillable = [
'team_id',
'event_id',
];
public function team()
{
return $this->belongsTo(Team::class);
}
public function event()
{
return $this->belongsTo(Event::class);
}
public function activityVerb()
{
return 'communityevent';
}
public function activityLazyLoading()
{
return ['team', 'event'];
}
public function activityActorMethodName()
{
return 'team';
}
}
So I have the actor set properly, it's just that it's setting the origin to essentially,
'user:' . Auth::user()->id
rather than,
$instance->activityActorMethodName() . ':' . $instance->id
Or am I completely missing the mark here and not setting something that I should be?
I overrided the above method returning an array of userIDs to be notified.
Strangely it did not work, I then used activityExtraData to achieve my purpose.
In the below piece of code the $feed isn't seem to be used?
$to = $this->activityNotify();
if ($to !== null){
$activity['to'] = array();
foreach ($to as $feed) {
$activity['to'][] = $to->getId();
}
}
Guys, I have an issue with Notification feeds not being removed on deletion.
The activity feed is removed but the notification feed entry is retained.
Seems to happen on some model only. I be using:
"get-stream/stream": "^2.3",
"get-stream/stream-laravel": "~2.2.6",
This is the sample screenshot:
User 1 Notification Feed (After delete):
User 2 Notification Feed (After delete):
This is the sample code:
public function eventPostDelete($conversationId, Request $request) {
$success = false;
$errors = [];
$conversation = EventConversation::find($conversationId);
if (!empty($conversation) && $conversation->author_id == Auth::user()->id) {
$evtcl = EventConversationLike::where("event_conversation_id", $conversationId)->get();
foreach ($evtcl as $i):
$i->delete();
endforeach;
$evtcm = EventConversationMention::where("event_conversation_id", $conversationId)->get();
foreach ($evtcm as $i):
$i->delete();
endforeach;
$ecrs = EventConversationReply::where("event_conversation_id", $conversationId)->orWhere("conversation_replies_parent_id", $conversationId)->get();
foreach($ecrs as $ecr) {
$evtcrl = EventConversationReplyLike::where("event_conversation_reply_id", $ecr->id)->get();
foreach ($evtcrl as $i):
$i->delete();
endforeach;
$evtcrm = EventConversationReplyMention::where("event_conversation_reply_id", $ecr->id)->get();
foreach ($evtcrm as $i):
$i->delete();
endforeach;
$ecr->delete();
}
$conversation->delete();
$success = true;
} else {
$errors[] = "Conversation not found.";
}
return response()->json([
'success' => $success,
'conversation' => $conversation,
'errors' => $errors
]);
}
App::share()
has been removed in 5.4 and replaced with App::singleton()
.
Just changing app->share
to app->singleton
then results in
[ErrorException]
Illegal offset type in unset
Which is resolved by removing the service provider from my app config.
Its a nice work but not suitable for laravel 5.2. Is it possible to update that?
Hi, when installing this package with laravel 5.4, The install goes well and no issues are shown untill you try to use laravel or artisan.
You then get this message:
FatalThrowableError in StreamLaravelServiceProvider.php line 45: Call to undefined method Illuminate\Foundation\Application::share()
Since following #43 and #42 i am getting the following error:
StreamFeedException in Feed.php line 102: {"code": 6, "detail": "The following feeds are not configured: 'user'. \nThis could be the cause of a typo, but otherwise you should configure them on the dashboard of this app.", "duration": "4ms", "exception": "FeedConfigException", "status_code": 400}
Any ideas what the best solution is?
In d1f196f you made a backwards compatibility breaking change.
Combined with the lack of a change log this may cause issues for consumers of your library (as it did for us). This should've been tagged 2.3.0, not 2.2.8.
Hey i'm fairly new so I'd like to apologies for the noob question/error.
So i'm getting the following error. I was wondering if anyone could point me in the right direction
PHP 42. App\Models\User->activityActor() /home/vagrant/Bold/vendor/get-stream/stream-laravel/src/GetStream/StreamLaravel/Eloquent/ActivityTrait.php:109
PHP 43. GetStream\StreamLaravel\Eloquent\Utils::createModelReference() /home/vagrant/Bold/vendor/get-stream/stream-laravel/src/GetStream/StreamLaravel/Eloquent/ActivityTrait.php:54
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to a member function getKey() on null
I have posted this issue on Stackoverflow, but would like to know your input about it as well, as I am not sure if this is a bug, or just some misconfiguration on my part. My issue is that posts coming from my Company feed does'nt seem to show up on the aggregated timeline, though it shows up perfectly on the non-aggregated.
I ran into a problem where the FeedManager behaved differently based on the Guzzle version that is used in the project.
This is set my stream-laravel.php config file (using Laravel 5.3.21):
/*
|-----------------------------------------------------------------------------
| The feeds that shows activities from followed user feeds
|-----------------------------------------------------------------------------
|
*/
'news_feeds' => array(
'timeline' => 'timeline',
'timeline_aggregated' => 'timeline_aggregated',
),
I've got this set up as a test url in my routes file:
Route::get('/test', function() {
dd(app()['config']->get('stream-laravel::news_feeds'));
}
When I'm using Guzzle 6 (guzzlehttp/guzzle 6.2.2), this route outputs this:
array:2 [▼
"timeline" => "timeline"
"timeline_aggregated" => "timeline_aggregated"
]
However, if my project is running guzzlehttp/guzzle 5.3.1 (I'm using bogardo/mailgun which is unfortunately a bit outdated and requires guzzle < 6). this is outputted:
array:4 [▼
"flat" => "flat"
"aggregated" => "aggregated"
"timeline" => "timeline"
"timeline_aggregated" => "timeline_aggregated"
]
That creates a problem, because when I'm running e.g. FeedManager::followUser(1, 3);
, I get a streamFeedException in getstream\stream
{"code": 6, "detail": "The following feeds are not configured: 'flat'", "duration": "9ms", "exception": "FeedConfigException", "status_code": 400}
So shouldn't Guzzle 6 be a requirement for stream-laravel?
It seems the Enrich.php also still have references to primaryKey id
Line 29 in function fromDB was changed to
$results[$object->getKey()] = $object;
which corrected the issue.
Kindly make sure all object references happen with getKey() on an Eloquent model level.
"get-stream/stream-laravel": "~2.0"
{"exception": "GetStreamAPI404", "detail": "sorry you've hit a 404"}
I am trying to use the stream-laravel for one of our social site notifications concepts. However I observe that when I am trying to use the ActivityTrait on an existing model which does not have a primary key as "id" but someother I am getting the above error.
I tried to overload the below methods activityActorMethodName & activityActorId for our model but without any change in result
Model: Activity
public function ownermember() {
return $this->belongsTo('User', 'memberID', 'memberID');
}
public function activityActorMethodName()
{
return 'ownermember';
}
public function activityActorId()
{
$actor = $this->{$this->activityActorMethodName()};
return $actor->memberId;
}
Doing some dd on the existing code base I came to conclusion of the primary key logic
dd($activity)
array (size=5)
'actor' => string 'User:' (length=5)
'verb' => string 'activity' (length=8)
'object' => string 'Activity:' (length=9)
'foreign_id' => string 'Activity:' (length=9)
'time' => string '2014-11-25T03:36:28+0000' (length=24)
some portion of dd($request)
object(GuzzleHttp\Message\Request)[360]
private 'url' =>
object(GuzzleHttp\Url)[361]
private 'scheme' => string 'https' (length=5)
private 'host' => string 'getstream.io' (length=12)
private 'port' => null
private 'username' => null
private 'password' => null
private 'path' => string '/api/v1.0/feed/user//' (length=21)
private 'fragment' => null
private 'query' =>
object(GuzzleHttp\Query)[365]
private 'encoding' => string 'rawurlencode' (length=12)
private 'aggregator' => null
protected 'data' =>
array (size=1)
The primaryKey for our User model is memberId.
We intend to host our solution on your platform in the longer run however this start is an impediment.
When attempting to enrich data as per the directions in the documentation I would always receive back an array of empty objects. After spending the better part of the day trying to figure out the discrepancy between what I was doing and what was going on in the examples and documentation I finally decided to explore the code a bit.
It seems that the issue resides on 66 of Enrich.php where the function attempts to establish each array item as an instance of EnrichedActivity. I'm far from a PHP expert... in fact, I couldn't easily write these classes my self...so I could be entirely off on this but since none of the class methods are used you just end up with an empty object. Anyhow... I have temporarily fixed this just by commenting out Line 95 and bypassing this function but it would be great to figure out a more official solution.
Is there any method for overriding the Guzzle client options? I know I can do something like what I have pasted below if I need to set an option, but what if I want to use the ActivityTrait along with Eloquent?
$feed = \FeedManager::getFeed('user', 1);
$feed->setGuzzleDefaultOption('verify', app_path().'/storage/certificates/cacert.pem');
$feed->addActivity([
'actor' => 'User:2',
'verb' => 'review',
'object' => 'Review:'.$review->id,
]);
Is there any way to set options to be passed into Guzzle without having to hook into each feed object?
I'm running on my development machine locally, and when I create a new item on a model that has ActivityTrait on it, I get the following error:
```cURL error 60: SSL certificate problem: self signed certificate in certificate chain (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)``
My app is in development mode and all the keys, etc are correct. Is there a way to bypass the ssl check for local development purposes?
Here is the stack trace:
…\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php187
70
GuzzleHttp\Handler\CurlFactory createRejection
…\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php150
69
GuzzleHttp\Handler\CurlFactory finishError
…\vendor\guzzlehttp\guzzle\src\Handler\CurlFactory.php103
68
GuzzleHttp\Handler\CurlFactory finish
…\vendor\guzzlehttp\guzzle\src\Handler\CurlHandler.php43
67
GuzzleHttp\Handler\CurlHandler __invoke
…\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php28
66
GuzzleHttp\Handler\Proxy GuzzleHttp\Handler\{closure}
…\vendor\guzzlehttp\guzzle\src\Handler\Proxy.php51
65
GuzzleHttp\Handler\Proxy GuzzleHttp\Handler\{closure}
…\vendor\guzzlehttp\guzzle\src\PrepareBodyMiddleware.php66
64
GuzzleHttp\PrepareBodyMiddleware __invoke
…\vendor\guzzlehttp\guzzle\src\Middleware.php30
63
GuzzleHttp\Middleware GuzzleHttp\{closure}
…\vendor\guzzlehttp\guzzle\src\RedirectMiddleware.php70
62
GuzzleHttp\RedirectMiddleware __invoke
…\vendor\guzzlehttp\guzzle\src\Middleware.php59
61
GuzzleHttp\Middleware GuzzleHttp\{closure}
…\vendor\guzzlehttp\guzzle\src\HandlerStack.php67
60
GuzzleHttp\HandlerStack __invoke
…\vendor\guzzlehttp\guzzle\src\Client.php277
59
GuzzleHttp\Client transfer
…\vendor\guzzlehttp\guzzle\src\Client.php125
58
GuzzleHttp\Client requestAsync
…\vendor\guzzlehttp\guzzle\src\Client.php131
57
GuzzleHttp\Client request
…\vendor\get-stream\stream\lib\GetStream\Stream\Feed.php97
56
GetStream\Stream\Feed makeHttpRequest
…\vendor\get-stream\stream\lib\GetStream\Stream\BaseFeed.php160
55
GetStream\Stream\BaseFeed addActivity
…\vendor\get-stream\stream-laravel\src\GetStream\StreamLaravel\StreamLaravelManager.php125
54
GetStream\StreamLaravel\StreamLaravelManager activityCreated
…\vendor\get-stream\stream-laravel\src\GetStream\StreamLaravel\Eloquent\CreateRemoveObserver.php12
53
GetStream\StreamLaravel\Eloquent\CreateRemoveObserver created
…\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php369
52
call_user_func_array
…\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php369
51
Illuminate\Events\Dispatcher Illuminate\Events\{closure}
…\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php200
50
Illuminate\Events\Dispatcher dispatch
…\vendor\laravel\framework\src\Illuminate\Events\Dispatcher.php173
49
Illuminate\Events\Dispatcher fire
…\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Concerns\HasEvents.php148
48
Illuminate\Database\Eloquent\Model fireModelEvent
…\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php708
47
Illuminate\Database\Eloquent\Model performInsert
…\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php550
46
Illuminate\Database\Eloquent\Model save
…\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\HasOneOrMany.php279
45
Illuminate\Database\Eloquent\Relations\HasOneOrMany Illuminate\Database\Eloquent\Relations\{closure}
…\vendor\laravel\framework\src\Illuminate\Support\helpers.php1038
44
tap
…\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Relations\HasOneOrMany.php280
43
Illuminate\Database\Eloquent\Relations\HasOneOrMany create
…\app\Http\Controllers\Post\PostController.php50
42
Trainerous\Http\Controllers\Post\PostController store
…\vendor\laravel\framework\src\Illuminate\Routing\Controller.php54
41
call_user_func_array
…\vendor\laravel\framework\src\Illuminate\Routing\Controller.php54
40
Illuminate\Routing\Controller callAction
…\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php45
39
Illuminate\Routing\ControllerDispatcher dispatch
…\vendor\laravel\framework\src\Illuminate\Routing\Route.php212
38
Illuminate\Routing\Route runController
…\vendor\laravel\framework\src\Illuminate\Routing\Route.php169
37
Illuminate\Routing\Route run
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php658
36
Illuminate\Routing\Router Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php30
35
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Middleware\SubstituteBindings.php41
34
Illuminate\Routing\Middleware\SubstituteBindings handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
33
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
32
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Auth\Middleware\Authenticate.php43
31
Illuminate\Auth\Middleware\Authenticate handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
30
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
29
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php102
28
Illuminate\Pipeline\Pipeline then
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php660
27
Illuminate\Routing\Router runRouteWithinStack
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php635
26
Illuminate\Routing\Router runRoute
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php601
25
Illuminate\Routing\Router dispatchToRoute
…\vendor\laravel\framework\src\Illuminate\Routing\Router.php590
24
Illuminate\Routing\Router dispatch
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php176
23
Illuminate\Foundation\Http\Kernel Illuminate\Foundation\Http\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php30
22
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\app\Http\Middleware\SignatureMiddleware.php18
21
Trainerous\Middleware\SignatureMiddleware handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
20
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
19
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\barryvdh\laravel-cors\src\HandleCors.php37
18
Barryvdh\Cors\HandleCors handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
17
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
16
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php30
15
Illuminate\Foundation\Http\Middleware\TransformsRequest handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
14
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
13
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\TransformsRequest.php30
12
Illuminate\Foundation\Http\Middleware\TransformsRequest handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
11
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
10
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\ValidatePostSize.php27
9
Illuminate\Foundation\Http\Middleware\ValidatePostSize handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
8
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
7
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode.php46
6
Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode handle
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php149
5
Illuminate\Pipeline\Pipeline Illuminate\Pipeline\{closure}
…\vendor\laravel\framework\src\Illuminate\Routing\Pipeline.php53
4
Illuminate\Routing\Pipeline Illuminate\Routing\{closure}
…\vendor\laravel\framework\src\Illuminate\Pipeline\Pipeline.php102
3
Illuminate\Pipeline\Pipeline then
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php151
2
Illuminate\Foundation\Http\Kernel sendRequestThroughRouter
…\vendor\laravel\framework\src\Illuminate\Foundation\Http\Kernel.php116
1
Illuminate\Foundation\Http\Kernel handle
…\public\index.php53
0
require_once
…\server.php21```
Great Laravel integration, I've been tinkering around with and really like it so far. But I'm a bit confused on how the activityNotify method works as part of the Activity class integrated with Eloquent.
I'm looking to do the following: when a user comments on a post, only the creator of the post is notified via the flat newsfeed, along with whatever other activities on his feed. No other users can see the comment activity, even if they are following the commenter.
Unless I am mistaken, it looks like the "to" or "target" field in the activity is where I can specify which user receives the activity, but I'm not sure how to set this in the context of automatic tracking of Eloquent models. I returned an instance of the feed class from the activityNotify method and created the activity, but don't see anything written for the target field in the database. Am I using the wrong method?
Are there any examples of how I can achieve what I'm looking to do? Or is there a better way to do this?
It's not compatible with Lumen. Can you create a package for Lumen?
Hi,
I tested and all methods work properly. Only the method getNotificationFeed () is giving me problems. I have two test users, which one follows the other and the other way around too. But any ID to put you in the method, always returns zero notifications.
What am I doing wrong? or what is the problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.