Fixed some sorting.

This commit is contained in:
James Cole
2015-07-08 13:05:33 +02:00
parent c00bcd78cc
commit 6900392e43
3 changed files with 26 additions and 16 deletions

View File

@@ -63,12 +63,19 @@ class AccountRepository implements AccountRepositoryInterface
*/
public function getAccounts(array $types)
{
/** @var Collection $result */
$result = Auth::user()->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
)->accountTypeIn($types)->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
$result = $result->sortBy(
function (Account $account) {
return strtolower($account->name);
}
);
return $result;
}