firefly-iii/app/Models/BudgetLimit.php
2016-01-01 21:49:27 +01:00

59 lines
1.5 KiB
PHP

<?php namespace FireflyIII\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* FireflyIII\Models\BudgetLimit
*
* @property integer $id
* @property Carbon $created_at
* @property Carbon $updated_at
* @property integer $budget_id
* @property Carbon $startdate
* @property float $amount
* @property boolean $repeats
* @property string $repeat_freq
* @property-read Budget $budget
* @property-read Collection|LimitRepetition[] $limitrepetitions
*/
class BudgetLimit extends Model
{
protected $hidden = ['amount_encrypted'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budget()
{
return $this->belongsTo('FireflyIII\Models\Budget');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate'];
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function limitrepetitions()
{
return $this->hasMany('FireflyIII\Models\LimitRepetition');
}
/**
* @param $value
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = strval(round($value, 2));
}
}