firefly-iii/app/models/BudgetLimit.php

53 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2014-07-30 15:31:35 -05:00
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model as Eloquent;
2014-07-30 15:31:35 -05:00
use Illuminate\Database\QueryException;
2014-12-06 05:12:55 -06:00
use Watson\Validating\ValidatingTrait;
2014-12-13 14:59:02 -06:00
/**
* Class Limit
*/
class BudgetLimit extends Eloquent
{
2014-12-06 05:12:55 -06:00
use ValidatingTrait;
public static $rules
2014-11-18 02:47:50 -06:00
= [
'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'
];
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
2014-07-30 15:31:35 -05:00
public function budget()
{
return $this->belongsTo('Budget');
2014-07-30 15:31:35 -05:00
}
2014-08-10 11:22:42 -05:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2014-07-22 23:57:51 -05:00
public function limitrepetitions()
{
return $this->hasMany('LimitRepetition');
}
2014-08-09 12:10:31 -05:00
2014-08-10 11:22:42 -05:00
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
}
2015-01-01 23:16:49 -06:00
}