mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-22 12:11:19 +00:00
Some more tests, don't know if they'll cover.
This commit is contained in:
@@ -13,6 +13,15 @@ class TransactionJournal extends Elegant
|
||||
'completed' => 'required|between:0,1'
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
'transaction_type_id' => 'factory|TransactionType',
|
||||
'transaction_currency_id' => 'factory|TransactionCurrency',
|
||||
'description' => 'string',
|
||||
'completed' => '1',
|
||||
'date' => 'date|Y-m-d'
|
||||
];
|
||||
|
||||
public function transactionType()
|
||||
{
|
||||
return $this->belongsTo('TransactionType');
|
||||
@@ -35,12 +44,16 @@ class TransactionJournal extends Elegant
|
||||
|
||||
public function budgets()
|
||||
{
|
||||
return $this->belongsToMany('Budget','component_transaction_journal','transaction_journal_id','component_id');
|
||||
return $this->belongsToMany(
|
||||
'Budget', 'component_transaction_journal', 'transaction_journal_id', 'component_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function categories()
|
||||
{
|
||||
return $this->belongsToMany('Category','component_transaction_journal','transaction_journal_id','component_id');
|
||||
return $this->belongsToMany(
|
||||
'Category', 'component_transaction_journal', 'transaction_journal_id', 'component_id'
|
||||
);
|
||||
}
|
||||
|
||||
public function getDates()
|
||||
@@ -48,11 +61,14 @@ class TransactionJournal extends Elegant
|
||||
return array('created_at', 'updated_at', 'date');
|
||||
}
|
||||
|
||||
public function scopeAfter($query, \Carbon\Carbon $date) {
|
||||
return $query->where('date','>=',$date->format('Y-m-d'));
|
||||
public function scopeAfter($query, \Carbon\Carbon $date)
|
||||
{
|
||||
return $query->where('date', '>=', $date->format('Y-m-d'));
|
||||
}
|
||||
public function scopeBefore($query, \Carbon\Carbon $date) {
|
||||
return $query->where('date','<=',$date->format('Y-m-d'));
|
||||
|
||||
public function scopeBefore($query, \Carbon\Carbon $date)
|
||||
{
|
||||
return $query->where('date', '<=', $date->format('Y-m-d'));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user