mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
New stuff for transaction edits [skip ci]
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
namespace Firefly\Storage\TransactionJournal;
|
||||
|
||||
|
||||
use Firefly\Exception\FireflyException;
|
||||
|
||||
class EloquentTransactionJournalRepository implements TransactionJournalRepositoryInterface
|
||||
{
|
||||
|
||||
@@ -167,7 +165,7 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
|
||||
}
|
||||
|
||||
public function getByAccountInDateRange(\Account $account, $count = 25,\Carbon\Carbon $start, \Carbon\Carbon $end)
|
||||
public function getByAccountInDateRange(\Account $account, $count = 25, \Carbon\Carbon $start, \Carbon\Carbon $end)
|
||||
{
|
||||
$accountID = $account->id;
|
||||
$query = \Auth::user()->transactionjournals()->with(
|
||||
@@ -180,8 +178,8 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->where('accounts.id', $accountID)
|
||||
->where('date','>=',$start->format('Y-m-d'))
|
||||
->where('date','<=',$end->format('Y-m-d'))
|
||||
->where('date', '>=', $start->format('Y-m-d'))
|
||||
->where('date', '<=', $end->format('Y-m-d'))
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->take($count)
|
||||
@@ -189,6 +187,26 @@ class EloquentTransactionJournalRepository implements TransactionJournalReposito
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function paginate($count = 25)
|
||||
{
|
||||
$query = \Auth::user()->transactionjournals()->with(
|
||||
[
|
||||
'transactions' => function ($q) {
|
||||
return $q->orderBy('amount', 'ASC');
|
||||
},
|
||||
'transactions.account',
|
||||
'transactions.account.accounttype',
|
||||
'transactioncurrency',
|
||||
'transactiontype'
|
||||
]
|
||||
)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.id', 'DESC')
|
||||
->take($count)
|
||||
->paginate($count);
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end)
|
||||
{
|
||||
// lets make this simple.
|
||||
|
@@ -11,10 +11,12 @@ interface TransactionJournalRepositoryInterface
|
||||
|
||||
public function find($journalId);
|
||||
|
||||
public function getByAccountInDateRange(\Account $account, $count = 25,\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
public function getByAccountInDateRange(\Account $account, $count = 25, \Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
|
||||
public function getByAccountAndDate(\Account $account, \Carbon\Carbon $date);
|
||||
|
||||
public function getByDateRange(\Carbon\Carbon $start, \Carbon\Carbon $end);
|
||||
|
||||
public function paginate($count = 25);
|
||||
|
||||
}
|
Reference in New Issue
Block a user