Skip to content

Commit

Permalink
Merge pull request #89 from petrokarpiuk/fix-dot-notation
Browse files Browse the repository at this point in the history
Fix - use dot notation to access config properties
  • Loading branch information
pterk authored Jun 22, 2020
2 parents 0379873 + 4c2799e commit 92b4bcd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -422,22 +422,22 @@ For convenience we includes a basic view:
<div class="container">
<div class="container-pins">
@foreach ($activities as $activity)
@include('stream-laravel::render_activity', ['activity' => $activity])
@include('stream-laravel.render_activity', ['activity' => $activity])
@endforeach
</div>
</div>
@stop
```

The ```stream-laravel::render_activity``` view tag will render the view activity.$activity["verb"] view with the activity as context.
The ```stream-laravel.render_activity``` view tag will render the view activity.$activity["verb"] view with the activity as context.

For example activity/tweet.blade.php will be used to render an normal activity with verb tweet and aggregated_activity/like.blade.php for an aggregated activity with verb like

If you need to support different kind of templates for the same activity, you can send a third parameter to change the view selection.

The example below will use the view activity/homepage_like.html
```
@include('stream-laravel::render_activity', ['activity' => $activity, 'prefix' => 'homepage'])
@include('stream-laravel.render_activity', ['activity' => $activity, 'prefix' => 'homepage'])
```


Expand Down
10 changes: 5 additions & 5 deletions src/GetStream/StreamLaravel/StreamLaravelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public function __construct($api_key, $api_secret, $config)
$this->client = Client::herokuConnect(getenv('STREAM_URL'));
} else {
$this->client = new Client($api_key, $api_secret);
$location = $this->config->get("stream-laravel::location");
$location = $this->config->get("stream-laravel.location");
$this->client->setLocation($location);
$this->client->timeout = $this->config->get("stream-laravel::timeout", 3);
$this->client->timeout = $this->config->get("stream-laravel.timeout", 3);
}
$this->userFeed = $this->config->get("stream-laravel::user_feed");
$this->userFeed = $this->config->get("stream-laravel.user_feed");
}

/**
Expand All @@ -62,7 +62,7 @@ public function getUserFeed($user_id)
*/
public function getNotificationFeed($user_id)
{
$user_feed = $this->config->get("stream-laravel::notification_feed");
$user_feed = $this->config->get("stream-laravel.notification_feed");
return $this->client->feed($user_feed, $user_id);
}

Expand All @@ -74,7 +74,7 @@ public function getNotificationFeed($user_id)
public function getNewsFeeds($user_id)
{
$feeds = [];
$news_feeds = $this->config->get("stream-laravel::news_feeds");
$news_feeds = $this->config->get("stream-laravel.news_feeds");
foreach ($news_feeds as $feed) {
$feeds[$feed] = $this->client->feed($feed, $user_id);
}
Expand Down
20 changes: 10 additions & 10 deletions tests/ManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ public function setUp()
{
parent::setUp();
$config = m::mock('ConfigMock');
$config->shouldReceive('get')->once()->with('stream-laravel::user_feed')
$config->shouldReceive('get')->once()->with('stream-laravel.user_feed')
->andReturn('user');
$config->shouldReceive('get')->once()->with('stream-laravel::notification_feed')
$config->shouldReceive('get')->once()->with('stream-laravel.notification_feed')
->andReturn('notification');
$config->shouldReceive('get')->once()->with('stream-laravel::location')
$config->shouldReceive('get')->once()->with('stream-laravel.location')
->andReturn('');
$config->shouldReceive('get')->once()->with('stream-laravel::news_feeds')
$config->shouldReceive('get')->once()->with('stream-laravel.news_feeds')
->andReturn(array('flat'=>'flat', 'aggregated'=>'aggregated'));
$config->shouldReceive('get')->once()->with('stream-laravel::timeout', 3)
$config->shouldReceive('get')->once()->with('stream-laravel.timeout', 3)
->andReturn(3);
$this->manager = new StreamLaravelManager('key', 'secret', $config);
}
Expand All @@ -32,15 +32,15 @@ public function testCustomTimeout()
{
parent::setUp();
$config = m::mock('ConfigMock');
$config->shouldReceive('get')->once()->with('stream-laravel::user_feed')
$config->shouldReceive('get')->once()->with('stream-laravel.user_feed')
->andReturn('user');
$config->shouldReceive('get')->once()->with('stream-laravel::notification_feed')
$config->shouldReceive('get')->once()->with('stream-laravel.notification_feed')
->andReturn('notification');
$config->shouldReceive('get')->once()->with('stream-laravel::location')
$config->shouldReceive('get')->once()->with('stream-laravel.location')
->andReturn('');
$config->shouldReceive('get')->once()->with('stream-laravel::news_feeds')
$config->shouldReceive('get')->once()->with('stream-laravel.news_feeds')
->andReturn(array('flat'=>'flat', 'aggregated'=>'aggregated'));
$config->shouldReceive('get')->once()->with('stream-laravel::timeout', 3)
$config->shouldReceive('get')->once()->with('stream-laravel.timeout', 3)
->andReturn(6);
$manager = new StreamLaravelManager('key', 'secret', $config);

Expand Down

0 comments on commit 92b4bcd

Please sign in to comment.