New converters for #180 (Tag and accounts)

This commit is contained in:
James Cole
2016-04-01 14:17:12 +02:00
parent c14fa1021c
commit fa38c975b6
6 changed files with 58 additions and 49 deletions

View File

@@ -112,11 +112,15 @@ class AccountRepository implements AccountRepositoryInterface
public function getAccounts(array $types): Collection
{
/** @var Collection $result */
$result = $this->user->accounts()->with(
$query = $this->user->accounts()->with(
['accountmeta' => function (HasMany $query) {
$query->where('name', 'accountRole');
}]
)->accountTypeIn($types)->get(['accounts.*']);
);
if (count($types) > 0) {
$query->accountTypeIn($types);
}
$result = $query->get(['accounts.*']);
$result = $result->sortBy(
function (Account $account) {