firefly-iii/app/models/BudgetLimit.php
2014-12-31 09:02:36 +01:00

52 lines
1.1 KiB
PHP

<?php
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model as Eloquent;
use Illuminate\Database\QueryException;
use Watson\Validating\ValidatingTrait;
/**
* Class Limit
*/
class BudgetLimit extends Eloquent
{
use ValidatingTrait;
public static $rules
= [
'budget_id' => 'required|exists:budgets,id',
'startdate' => 'required|date',
'amount' => 'numeric|required|min:0.01',
'repeats' => 'required|boolean',
'repeat_freq' => 'required|in:daily,weekly,monthly,quarterly,half-year,yearly'
];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budget()
{
return $this->belongsTo('Budget');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function limitrepetitions()
{
return $this->hasMany('LimitRepetition');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
}
}