This commit is contained in:
James Cole
2019-10-19 19:17:14 +02:00
parent 2d720f72bd
commit 6efe5cfd4d
7 changed files with 138 additions and 10 deletions

View File

@@ -318,9 +318,8 @@ class AccountRepository implements AccountRepositoryInterface
$query->where('active', 1);
$query->orderBy('accounts.account_type_id', 'ASC');
$query->orderBy('accounts.name', 'ASC');
$result = $query->get(['accounts.*']);
return $result;
return $query->get(['accounts.*']);
}
/**
@@ -606,4 +605,27 @@ class AccountRepository implements AccountRepositoryInterface
return $account;
}
/**
* @param array $types
*
* @return Collection
*/
public function getInactiveAccountsByType(array $types): Collection
{
/** @var Collection $result */
$query = $this->user->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'account_role');
}]
);
if (count($types) > 0) {
$query->accountTypeIn($types);
}
$query->where('active', 0);
$query->orderBy('accounts.account_type_id', 'ASC');
$query->orderBy('accounts.name', 'ASC');
return $query->get(['accounts.*']);
}
}