Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ php:
- 5.6
- hhvm

env:
- LARAVEL_VERSION="4.2.*"
- LARAVEL_VERSION="5.0.*"

before_script:
- travis_retry composer self-update
- travis_retry composer require laravel/framework:${LARAVEL_VERSION} --no-update
- travis_retry composer require illuminate/support:${LARAVEL_VERSION} --no-update
- travis_retry composer require illuminate/database:${LARAVEL_VERSION} --no-update
- travis_retry composer install --prefer-source --no-interaction --dev

script: phpunit
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
],
"require": {
"php": ">=5.4.0",
"illuminate/support": "4.2.*",
"illuminate/database": "4.2.*",
"illuminate/support": ">=4.2",
"illuminate/database": ">=4.2",
"get-stream/stream": "~2.1"
},
"require-dev": {
Expand All @@ -27,3 +27,4 @@
},
"minimum-stability": "stable"
}

2 changes: 1 addition & 1 deletion src/GetStream/StreamLaravel/StreamLaravelManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ public function activityDeleted($instance)
$feed->removeActivity($foreignId, true);
}

}
}
43 changes: 41 additions & 2 deletions src/GetStream/StreamLaravel/StreamLaravelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,16 @@ class StreamLaravelServiceProvider extends ServiceProvider {
*/
public function boot()
{
$this->package('get-stream/stream-laravel');
if (method_exists($this, 'publishes')) {
$this->loadViewsFrom(__DIR__.'/../../views', 'stream-laravel');

$this->publishes([
__DIR__.'/../../config/config.php' => config_path('stream-laravel.php'),
__DIR__.'/../../views' => base_path('resources/views/vendor/stream-laravel'),
]);
} else {
$this->package('get-stream/stream-laravel');
}
}

/**
Expand All @@ -28,15 +37,45 @@ public function boot()
*/
public function register()
{

if (method_exists($this, 'publishes')) {
$this->registerResources();
}

$this->app['feed_manager'] = $this->app->share(function($app)
{

$manager_class = $app['config']->get('stream-laravel::feed_manager_class');
$api_key = $app['config']->get('stream-laravel::api_key');
$api_secret = $app['config']->get('stream-laravel::api_secret');
return new $manager_class($api_key, $api_secret, $app['config']);

return new $manager_class($api_key, $api_secret, $this->app['config']);
});
}

/**
* Register the package resources.
*
* @return void
*/
protected function registerResources()
{
$userConfigFile = app()->configPath().'/stream-laravel.php';
$packageConfigFile = __DIR__.'/../../config/config.php';
$config = $this->app['files']->getRequire($packageConfigFile);

if (file_exists($userConfigFile)) {
$userConfig = $this->app['files']->getRequire($userConfigFile);
$config = array_replace_recursive($config, $userConfig);
}

$namespace = 'stream-laravel::';

foreach($config as $key => $value) {
$this->app['config']->set($namespace . $key , $value);
}
}

/**
* Get the services provided by the provider.
*
Expand Down
4 changes: 2 additions & 2 deletions src/config/config.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return array(
return [

/*
|-----------------------------------------------------------------------------
Expand Down Expand Up @@ -46,4 +46,4 @@
'flat' => 'flat',
'aggregated' => 'aggregated',
)
);
];
3 changes: 2 additions & 1 deletion src/views/render_activity.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@
@endif
@endif
@else
{{ ''; Log::warning('The activity could not be rendered, the following field/refs could not be enriched:', $activity->getNotEnrichedData()); }}
{{ '' }}
Log::warning('The activity could not be rendered, the following field/refs could not be enriched:', $activity->getNotEnrichedData());
@endif