firefly-iii/app/Models/BudgetLimit.php

49 lines
1.0 KiB
PHP
Raw Normal View History

2016-05-20 01:57:45 -05:00
<?php
/**
* BudgetLimit.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
2016-05-20 01:57:45 -05:00
declare(strict_types = 1);
namespace FireflyIII\Models;
2015-02-27 09:48:33 -06:00
use Illuminate\Database\Eloquent\Model;
class BudgetLimit extends Model
{
2016-01-15 16:12:52 -06:00
protected $dates = ['created_at', 'updated_at', 'startdate'];
protected $hidden = ['amount_encrypted'];
2015-05-23 10:11:16 -05:00
2015-02-27 09:48:33 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budget()
{
return $this->belongsTo('FireflyIII\Models\Budget');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function limitrepetitions()
{
return $this->hasMany('FireflyIII\Models\LimitRepetition');
}
2015-05-23 01:46:46 -05:00
/**
* @param $value
*/
public function setAmountAttribute($value)
{
2015-05-24 01:00:40 -05:00
$this->attributes['amount'] = strval(round($value, 2));
2015-05-23 01:46:46 -05:00
}
2015-02-27 09:48:33 -06:00
}