Updated export job repository

This commit is contained in:
James Cole
2016-03-03 08:53:05 +01:00
parent ca33bea6b7
commit b4f1bbf793
3 changed files with 67 additions and 4 deletions

View File

@@ -0,0 +1,50 @@
<?php
namespace FireflyIII\Providers;
use Auth;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
/**
* Class ExportJobServiceProvider
*
* @package FireflyIII\Providers
*/
class ExportJobServiceProvider extends ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public function boot()
{
$this->app->bind(
'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface',
function (Application $app, array $arguments) {
if (!isset($arguments[0]) && Auth::check()) {
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [Auth::user()]);
} else {
if (!isset($arguments[0]) && !Auth::check()) {
throw new FireflyException('There is no user present.');
}
}
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', $arguments);
}
);
}
/**
* Register the application services.
*
* @return void
*/
public function register()
{
//
}
}