mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
New event to create budget limits, new handler to handle said event, new routes for budget control, new routes for limit control, extended migration, extended models, extended JS. [skip-ci]
This commit is contained in:
@@ -2,6 +2,29 @@
|
||||
|
||||
use LaravelBook\Ardent\Ardent as Ardent;
|
||||
|
||||
/**
|
||||
* Limit
|
||||
*
|
||||
* @property integer $id
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
* @property integer $component_id
|
||||
* @property \Carbon\Carbon $startdate
|
||||
* @property float $amount
|
||||
* @property boolean $repeats
|
||||
* @property string $repeat_freq
|
||||
* @property-read \Component $component
|
||||
* @property-read \Budget $budget
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\LimitRepetition[] $limitrepetitions
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereComponentId($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereStartdate($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereAmount($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeats($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\Limit whereRepeatFreq($value)
|
||||
*/
|
||||
class Limit extends Ardent
|
||||
{
|
||||
|
||||
@@ -9,8 +32,9 @@ class Limit extends Ardent
|
||||
= [
|
||||
'component_id' => 'required|exists:components,id',
|
||||
'startdate' => 'required|date',
|
||||
'enddate' => 'required|date',
|
||||
'amount' => 'numeric|required|min:0.01'
|
||||
'amount' => 'numeric|required|min:0.01',
|
||||
'repeats' => 'required|between:0,1',
|
||||
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
|
||||
|
||||
];
|
||||
|
||||
@@ -24,7 +48,7 @@ class Limit extends Ardent
|
||||
|
||||
public function component()
|
||||
{
|
||||
return $this->belongsTo('Component');
|
||||
return $this->belongsTo('Component','component_id');
|
||||
}
|
||||
|
||||
public function budget()
|
||||
@@ -32,6 +56,10 @@ class Limit extends Ardent
|
||||
return $this->belongsTo('Budget', 'component_id');
|
||||
}
|
||||
|
||||
public function limitrepetitions() {
|
||||
return $this->hasMany('LimitRepetition');
|
||||
}
|
||||
|
||||
public function getDates()
|
||||
{
|
||||
return ['created_at', 'updated_at', 'startdate', 'enddate'];
|
||||
|
||||
Reference in New Issue
Block a user