Covered the JSON controller.

This commit is contained in:
James Cole
2015-04-11 19:59:41 +02:00
parent 6157d82a0b
commit c37e9a4467
4 changed files with 270 additions and 26 deletions

View File

@@ -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];
}
}