This commit is contained in:
James Cole
2019-09-15 08:48:51 +02:00
parent 595a90cb0a
commit ef85b1180f
4 changed files with 23 additions and 2 deletions

View File

@@ -55,8 +55,8 @@ class AccountList implements BinderInterface
->where('account_types.type', AccountType::ASSET) ->where('account_types.type', AccountType::ASSET)
->orderBy('accounts.name', 'ASC') ->orderBy('accounts.name', 'ASC')
->get(['accounts.*']); ->get(['accounts.*']);
//Log::debug(sprintf('Collection length is %d', $collection->count()));
} }
if ('allAssetAccounts' !== $value) { if ('allAssetAccounts' !== $value) {
$incoming = array_map('\intval', explode(',', $value)); $incoming = array_map('\intval', explode(',', $value));
$list = array_merge(array_unique($incoming), [0]); $list = array_merge(array_unique($incoming), [0]);

View File

@@ -43,8 +43,15 @@ class BudgetList implements BinderInterface
*/ */
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {
//Log::debug(sprintf('Now in BudgetList::routeBinder("%s")', $value));
if (auth()->check()) { 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))); $list = array_unique(array_map('\intval', explode(',', $value)));
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart

View File

@@ -43,6 +43,12 @@ class CategoryList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {
if (auth()->check()) { if (auth()->check()) {
if ('allCategories' === $value) {
return auth()->user()->categories()
->orderBy('name', 'ASC')
->get();
}
$list = array_unique(array_map('\intval', explode(',', $value))); $list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) { if (0 === count($list)) {
throw new NotFoundHttpException; // @codeCoverageIgnore throw new NotFoundHttpException; // @codeCoverageIgnore

View File

@@ -44,6 +44,14 @@ class TagList implements BinderInterface
public static function routeBinder(string $value, Route $route): Collection public static function routeBinder(string $value, Route $route): Collection
{ {
if (auth()->check()) { if (auth()->check()) {
if ('allTags' === $value) {
return auth()->user()->tags()
->orderBy('tag', 'ASC')
->get();
}
$list = array_unique(array_map('\strtolower', explode(',', $value))); $list = array_unique(array_map('\strtolower', explode(',', $value)));
Log::debug('List of tags is', $list); Log::debug('List of tags is', $list);
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart