From ef85b1180fd4693bf353b2e8030bd7e98b1873bc Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 15 Sep 2019 08:48:51 +0200 Subject: [PATCH] Fix #2603 --- app/Support/Binder/AccountList.php | 2 +- app/Support/Binder/BudgetList.php | 9 ++++++++- app/Support/Binder/CategoryList.php | 6 ++++++ app/Support/Binder/TagList.php | 8 ++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) diff --git a/app/Support/Binder/AccountList.php b/app/Support/Binder/AccountList.php index a64b0c43b4..5700423bfc 100644 --- a/app/Support/Binder/AccountList.php +++ b/app/Support/Binder/AccountList.php @@ -55,8 +55,8 @@ class AccountList implements BinderInterface ->where('account_types.type', AccountType::ASSET) ->orderBy('accounts.name', 'ASC') ->get(['accounts.*']); - //Log::debug(sprintf('Collection length is %d', $collection->count())); } + if ('allAssetAccounts' !== $value) { $incoming = array_map('\intval', explode(',', $value)); $list = array_merge(array_unique($incoming), [0]); diff --git a/app/Support/Binder/BudgetList.php b/app/Support/Binder/BudgetList.php index d846318390..ca816d6aca 100644 --- a/app/Support/Binder/BudgetList.php +++ b/app/Support/Binder/BudgetList.php @@ -43,8 +43,15 @@ class BudgetList implements BinderInterface */ public static function routeBinder(string $value, Route $route): Collection { - //Log::debug(sprintf('Now in BudgetList::routeBinder("%s")', $value)); if (auth()->check()) { + + if ('allBudgets' === $value) { + return auth()->user()->budgets()->where('active', 1) + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get(); + } + $list = array_unique(array_map('\intval', explode(',', $value))); // @codeCoverageIgnoreStart diff --git a/app/Support/Binder/CategoryList.php b/app/Support/Binder/CategoryList.php index c68d75823d..df3ab03cf4 100644 --- a/app/Support/Binder/CategoryList.php +++ b/app/Support/Binder/CategoryList.php @@ -43,6 +43,12 @@ class CategoryList implements BinderInterface public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { + if ('allCategories' === $value) { + return auth()->user()->categories() + ->orderBy('name', 'ASC') + ->get(); + } + $list = array_unique(array_map('\intval', explode(',', $value))); if (0 === count($list)) { throw new NotFoundHttpException; // @codeCoverageIgnore diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php index 62d64dd568..707576041a 100644 --- a/app/Support/Binder/TagList.php +++ b/app/Support/Binder/TagList.php @@ -44,6 +44,14 @@ class TagList implements BinderInterface public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { + + if ('allTags' === $value) { + return auth()->user()->tags() + ->orderBy('tag', 'ASC') + ->get(); + } + + $list = array_unique(array_map('\strtolower', explode(',', $value))); Log::debug('List of tags is', $list); // @codeCoverageIgnoreStart