mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New method to collect a users accounts by the given ids.
This commit is contained in:
parent
5c3165efa2
commit
55e4875662
@ -72,6 +72,18 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return Auth::user()->accounts()->findOrNew($accountId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets all the accounts by ID, for a given set.
|
||||
*
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function get(array $ids)
|
||||
{
|
||||
return Auth::user()->accounts()->whereIn('id', $ids)->get(['accounts.*']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
*
|
||||
@ -464,9 +476,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
if (!$existingAccount) {
|
||||
Log::error('Account create error: ' . $newAccount->getErrors()->toJson());
|
||||
abort(500);
|
||||
// @codeCoverageIgnoreStart
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
$newAccount = $existingAccount;
|
||||
|
||||
}
|
||||
@ -554,7 +564,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
{
|
||||
$journal->date = $data['openingBalanceDate'];
|
||||
$journal->save();
|
||||
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($journal->transactions()->get() as $transaction) {
|
||||
if ($account->id == $transaction->account_id) {
|
||||
|
@ -17,6 +17,7 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface AccountRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
*
|
||||
@ -41,6 +42,15 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function find($accountId);
|
||||
|
||||
/**
|
||||
* Gets all the accounts by ID, for a given set.
|
||||
*
|
||||
* @param array $ids
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function get(array $ids);
|
||||
|
||||
/**
|
||||
* @param array $types
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user