Skip to content

Firefly III: a personal finances manager

Update the last providers.

James Cole152fb3f885c8
diff --git a/app/Providers/ExportJobServiceProvider.php b/app/Providers/ExportJobServiceProvider.php
index 7c12925df1..6850f417b5 100644
--- a/app/Providers/ExportJobServiceProvider.php
+++ b/app/Providers/ExportJobServiceProvider.php
@@ -14,9 +14,10 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
-use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\ExportJob\ExportJobRepository;
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
+use FireflyIII\Repositories\ImportJob\ImportJobRepository;
+use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -72,16 +73,15 @@ class ExportJobServiceProvider extends ServiceProvider
private function importJob()
{
$this->app->bind(
- 'FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface',
- function (Application $app, array $arguments) {
- if (!isset($arguments[0]) && $app->auth->check()) {
- return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', [auth()->user()]);
- }
- if (!isset($arguments[0]) && !$app->auth->check()) {
- throw new FireflyException('There is no user present.');
+ ImportJobRepositoryInterface::class,
+ function (Application $app) {
+ /** @var ImportJobRepository $repository */
+ $repository = app(ImportJobRepository::class);
+ if ($app->auth->check()) {
+ $repository->setUser(auth()->user());
}
- return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', $arguments);
+ return $repository;
}
);
}
diff --git a/app/Providers/RuleGroupServiceProvider.php b/app/Providers/RuleGroupServiceProvider.php
index c6b86c1604..0a3c8db599 100644
--- a/app/Providers/RuleGroupServiceProvider.php
+++ b/app/Providers/RuleGroupServiceProvider.php
@@ -46,7 +46,7 @@ class RuleGroupServiceProvider extends ServiceProvider
{
$this->app->bind(
RuleGroupRepositoryInterface::class,
- function (Application $app, array $arguments) {
+ function (Application $app) {
/** @var RuleGroupRepository $repository */
$repository = app(RuleGroupRepository::class);
if ($app->auth->check()) {
diff --git a/app/Providers/RuleServiceProvider.php b/app/Providers/RuleServiceProvider.php
index a395e8cda3..5d694411b3 100644
--- a/app/Providers/RuleServiceProvider.php
+++ b/app/Providers/RuleServiceProvider.php
@@ -14,7 +14,8 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
-use FireflyIII\Exceptions\FireflyException;
+use FireflyIII\Repositories\Rule\RuleRepository;
+use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -43,16 +44,14 @@ class RuleServiceProvider extends ServiceProvider
public function register()
{
$this->app->bind(
- 'FireflyIII\Repositories\Rule\RuleRepositoryInterface',
- function (Application $app, array $arguments) {
- if (!isset($arguments[0]) && $app->auth->check()) {
- return app('FireflyIII\Repositories\Rule\RuleRepository', [auth()->user()]);
+ RuleRepositoryInterface::class,
+ function (Application $app) {
+ /** @var RuleRepository $repository */
+ $repository = app(RuleRepository::class);
+ if ($app->auth->check()) {
+ $repository->setUser(auth()->user());
}
- if (!isset($arguments[0]) && !$app->auth->check()) {
- throw new FireflyException('There is no user present.');
- }
-
- return app('FireflyIII\Repositories\Rule\RuleRepository', $arguments);
+ return $repository;
}
);
}
diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php
index a7be767e5e..18d5b48c6e 100644
--- a/app/Providers/SearchServiceProvider.php
+++ b/app/Providers/SearchServiceProvider.php
@@ -14,7 +14,8 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
-use FireflyIII\Exceptions\FireflyException;
+use FireflyIII\Support\Search\Search;
+use FireflyIII\Support\Search\SearchInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -43,16 +44,15 @@ class SearchServiceProvider extends ServiceProvider
public function register()
{
$this->app->bind(
- 'FireflyIII\Support\Search\SearchInterface',
- function (Application $app, array $arguments) {
- if (!isset($arguments[0]) && $app->auth->check()) {
- return app('FireflyIII\Support\Search\Search', [auth()->user()]);
- }
- if (!isset($arguments[0]) && !$app->auth->check()) {
- throw new FireflyException('There is no user present.');
+ SearchInterface::class,
+ function (Application $app) {
+ /** @var Search $search */
+ $search = app(Search::class);
+ if ($app->auth->check()) {
+ $search->setUser(auth()->user());
}
- return app('FireflyIII\Support\Search\Search', $arguments);
+ return $search;
}
);
}
diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php
index 8889c9fbeb..b5daa36c6c 100644
--- a/app/Providers/TagServiceProvider.php
+++ b/app/Providers/TagServiceProvider.php
@@ -14,7 +14,8 @@ declare(strict_types = 1);
namespace FireflyIII\Providers;
-use FireflyIII\Exceptions\FireflyException;
+use FireflyIII\Repositories\Tag\TagRepository;
+use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Foundation\Application;
use Illuminate\Support\ServiceProvider;
@@ -43,16 +44,16 @@ class TagServiceProvider extends ServiceProvider
public function register()
{
$this->app->bind(
- 'FireflyIII\Repositories\Tag\TagRepositoryInterface',
- function (Application $app, array $arguments) {
- if (!isset($arguments[0]) && $app->auth->check()) {
- return app('FireflyIII\Repositories\Tag\TagRepository', [auth()->user()]);
- }
- if (!isset($arguments[0]) && !$app->auth->check()) {
- throw new FireflyException('There is no user present.');
+ TagRepositoryInterface::class,
+ function (Application $app) {
+ /** @var TagRepository $repository */
+ $repository = app(TagRepository::class);
+
+ if ($app->auth->check()) {
+ $repository->setUser(auth()->user());
}
- return app('FireflyIII\Repositories\Tag\TagRepository', $arguments);
+ return $repository;
}
);
}