Skip to content

Commit 2f761c1

Browse files
stream-laravel for laravel 5
1 parent f316616 commit 2f761c1

File tree

4 files changed

+26
-14
lines changed

4 files changed

+26
-14
lines changed

src/GetStream/StreamLaravel/StreamLaravelManager.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
class StreamLaravelManager {
66

77
public $client;
8-
private $config;
98

109
public function __construct($api_key, $api_secret, $config)
1110
{
12-
$this->config = $config;
1311
if (getenv('STREAM_URL') !== false) {
1412
$this->client = Client::herokuConnect(getenv('STREAM_URL'));
1513
} else {
16-
$this->client = new Client($api_key, $api_secret);
17-
$location = $this->config->get("stream-laravel::location");
14+
$this->client = new Client($api_key, $api_secret, 'v1.0', '', 10);
15+
$location = config("getstream.location");
1816
$this->client->setLocation($location);
1917
}
20-
$this->userFeed = $this->config->get("stream-laravel::user_feed");
18+
$this->userFeed = config("getstream.user_feed");
2119
}
2220

2321
public function getUserFeed($user_id)
@@ -27,14 +25,14 @@ public function getUserFeed($user_id)
2725

2826
public function getNotificationFeed($user_id)
2927
{
30-
$user_feed = $this->config->get("stream-laravel::notification_feed");
28+
$user_feed = config("getstream.notification_feed");
3129
return $this->client->feed($user_feed, $user_id);
3230
}
3331

3432
public function getNewsFeeds($user_id)
3533
{
3634
$feeds = array();
37-
$news_feeds = $this->config->get("stream-laravel::news_feeds");
35+
$news_feeds = config("getstream.news_feeds");
3836
foreach ($news_feeds as $feed) {
3937
$feeds[$feed] = $this->client->feed($feed, $user_id);
4038
}

src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,14 @@ class StreamLaravelServiceProvider extends ServiceProvider {
1818
*/
1919
public function boot()
2020
{
21-
$this->package('get-stream/stream-laravel');
21+
// $this->registerResources();
22+
23+
$this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel');
24+
25+
$this->publishes([
26+
__DIR__.'/../../config/config.php' => config_path('getstream.php'),
27+
__DIR__.'/../../views' => base_path('resources/views/vendor/stream-laravel'),
28+
]);
2229
}
2330

2431
/**
@@ -28,11 +35,17 @@ public function boot()
2835
*/
2936
public function register()
3037
{
38+
$this->mergeConfigFrom(
39+
__DIR__.'/../../config/config.php', 'getstream'
40+
);
41+
3142
$this->app['feed_manager'] = $this->app->share(function($app)
3243
{
33-
$manager_class = $app['config']->get('stream-laravel::feed_manager_class');
34-
$api_key = $app['config']->get('stream-laravel::api_key');
35-
$api_secret = $app['config']->get('stream-laravel::api_secret');
44+
45+
$manager_class = config('getstream.feed_manager_class');
46+
$api_key = config('getstream.api_key');
47+
$api_secret = config('getstream.api_secret');
48+
3649
return new $manager_class($api_key, $api_secret, $app['config']);
3750
});
3851
}

src/config/config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
return array(
3+
return [
44

55
/*
66
|-----------------------------------------------------------------------------
@@ -46,4 +46,4 @@
4646
'flat' => 'flat',
4747
'aggregated' => 'aggregated',
4848
)
49-
);
49+
];

src/views/render_activity.blade.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
@endif
1414
@endif
1515
@else
16-
{{ ''; Log::warning('The activity could not be rendered, the following field/refs could not be enriched:', $activity->getNotEnrichedData()); }}
16+
{{ }}
17+
Log::warning('The activity could not be rendered, the following field/refs could not be enriched:', $activity->getNotEnrichedData());
1718
@endif

0 commit comments

Comments
 (0)