mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Covered the JSON controller.
This commit is contained in:
@@ -62,6 +62,26 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
return $journal->transactions()->first()->account_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionType $dbType
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournalsOfType(TransactionType $dbType)
|
||||
{
|
||||
return Auth::user()->transactionjournals()->where('transaction_type_id', $dbType->id)->orderBy('id', 'DESC')->take(50)->get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return TransactionType
|
||||
*/
|
||||
public function getTransactionType($type)
|
||||
{
|
||||
return TransactionType::whereType($type)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param TransactionJournal $journal
|
||||
@@ -289,5 +309,4 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
return [$from, $to];
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -13,6 +14,13 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Get users first transaction journal
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function first();
|
||||
|
||||
/**
|
||||
*
|
||||
* Get the account_id, which is the asset account that paid for the transaction.
|
||||
@@ -23,6 +31,13 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function getAssetAccount(TransactionJournal $journal);
|
||||
|
||||
/**
|
||||
* @param TransactionType $dbType
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournalsOfType(TransactionType $dbType);
|
||||
|
||||
/**
|
||||
* @param string $query
|
||||
* @param TransactionJournal $journal
|
||||
@@ -31,6 +46,13 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function searchRelated($query, TransactionJournal $journal);
|
||||
|
||||
|
||||
/**
|
||||
* @param $type
|
||||
*
|
||||
* @return TransactionType
|
||||
*/
|
||||
public function getTransactionType($type);
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
@@ -45,11 +67,4 @@ interface JournalRepositoryInterface
|
||||
* @return mixed
|
||||
*/
|
||||
public function update(TransactionJournal $journal, array $data);
|
||||
|
||||
/**
|
||||
* Get users first transaction journal
|
||||
*
|
||||
* @return TransactionJournal
|
||||
*/
|
||||
public function first();
|
||||
}
|
||||
|
Reference in New Issue
Block a user