mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Add some extra filters [skip ci]
This commit is contained in:
parent
bbfc962727
commit
d6e2d8e4a2
@ -37,6 +37,9 @@ class AccountList implements BinderInterface
|
|||||||
if (Auth::check()) {
|
if (Auth::check()) {
|
||||||
|
|
||||||
$ids = explode(',', $value);
|
$ids = explode(',', $value);
|
||||||
|
// filter ids:
|
||||||
|
$ids = self::filterIds($ids);
|
||||||
|
|
||||||
/** @var \Illuminate\Support\Collection $object */
|
/** @var \Illuminate\Support\Collection $object */
|
||||||
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
|
||||||
->where('account_types.editable', 1)
|
->where('account_types.editable', 1)
|
||||||
@ -49,4 +52,22 @@ class AccountList implements BinderInterface
|
|||||||
}
|
}
|
||||||
throw new NotFoundHttpException;
|
throw new NotFoundHttpException;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $ids
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
protected static function filterIds(array $ids): array
|
||||||
|
{
|
||||||
|
$new = [];
|
||||||
|
foreach ($ids as $id) {
|
||||||
|
if (intval($id) > 0) {
|
||||||
|
$new[] = $id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$new = array_unique($new);
|
||||||
|
|
||||||
|
return $new;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user