mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
- Full move to high charts.
- Cleanup homepage. - Expanded libraries - Added limits (for budgets) - Extended models - Added popups for charts. - [skip-ci]
This commit is contained in:
@@ -88,10 +88,14 @@ class Account extends Ardent
|
||||
->leftJoin(
|
||||
'transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'
|
||||
)
|
||||
->where('transaction_journals.date', '<=', $date->format('Y-m-d'))->sum('transactions.amount')
|
||||
->where('transaction_journals.date', '<', $date->format('Y-m-d'))->sum('transactions.amount')
|
||||
);
|
||||
}
|
||||
|
||||
public function predict(\Carbon\Carbon $date) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transactions.
|
||||
*
|
||||
|
||||
@@ -42,6 +42,10 @@ class Component extends Firefly\Database\SingleTableInheritanceEntity
|
||||
return $this->belongsToMany('Transaction');
|
||||
}
|
||||
|
||||
public function limits() {
|
||||
return $this->belongsTo('Limit');
|
||||
}
|
||||
|
||||
public function transactionjournals()
|
||||
{
|
||||
return $this->belongsToMany('TransactionJournal');
|
||||
|
||||
41
app/models/Limit.php
Normal file
41
app/models/Limit.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
class Limit extends Ardent
|
||||
{
|
||||
|
||||
public static $rules
|
||||
= [
|
||||
'component_id' => 'required|exists:components,id',
|
||||
'startdate' => 'required|date',
|
||||
'enddate' => 'required|date',
|
||||
'amount' => 'numeric|required|min:0.01'
|
||||
|
||||
];
|
||||
|
||||
public static $factory
|
||||
= [
|
||||
'component_id' => 'factory|Budget',
|
||||
'startdate' => 'date',
|
||||
'enddate' => 'date',
|
||||
'amount' => '100'
|
||||
];
|
||||
|
||||
public function component()
|
||||
{
|
||||
return $this->belongsTo('Component');
|
||||
}
|
||||
|
||||
public function budget()
|
||||
{
|
||||
return $this->belongsTo('Budget', 'component_id');
|
||||
}
|
||||
|
||||
public function getDates()
|
||||
{
|
||||
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user