firefly-iii/app/Models/LimitRepetition.php

58 lines
2.1 KiB
PHP
Raw Normal View History

2015-02-27 09:48:33 -06:00
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class LimitRepetition
*
2015-06-14 04:51:33 -05:00
* @codeCoverageIgnore
2015-02-27 09:48:33 -06:00
* @package FireflyIII\Models
2015-06-03 14:25:11 -05:00
* @property integer $id
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property integer $budget_limit_id
* @property \Carbon\Carbon $startdate
* @property \Carbon\Carbon $enddate
* @property float $amount
* @property string $amount_encrypted
2015-05-26 05:19:11 -05:00
* @property-read \FireflyIII\Models\BudgetLimit $budgetLimit
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereCreatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereUpdatedAt($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereBudgetLimitId($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereStartdate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereEnddate($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmount($value)
* @method static \Illuminate\Database\Query\Builder|\FireflyIII\Models\LimitRepetition whereAmountEncrypted($value)
2015-02-27 09:48:33 -06:00
*/
class LimitRepetition extends Model
{
2015-05-23 10:11:16 -05:00
protected $hidden = ['amount_encrypted'];
2015-02-27 09:48:33 -06:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budgetLimit()
{
return $this->belongsTo('FireflyIII\Models\BudgetLimit');
}
2015-05-23 10:11:16 -05:00
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
}
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
}