Files
firefly-iii/app/Models/Budget.php

60 lines
1.3 KiB
PHP
Raw Normal View History

2015-02-06 04:52:16 +01:00
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
2015-02-06 04:52:16 +01:00
2015-02-11 07:35:10 +01:00
/**
* Class Budget
*
* @package FireflyIII\Models
*/
2015-02-06 05:04:06 +01:00
class Budget extends Model
{
2015-02-06 04:52:16 +01:00
use SoftDeletes;
2015-02-06 05:14:27 +01:00
2015-02-22 15:40:13 +01:00
protected $fillable = ['user_id', 'name'];
2015-02-11 07:35:10 +01:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
2015-02-06 05:14:27 +01:00
public function budgetlimits()
{
2015-02-06 05:35:00 +01:00
return $this->hasMany('FireflyIII\Models\BudgetLimit');
2015-02-06 05:14:27 +01:00
}
2015-02-11 07:35:10 +01:00
/**
* @return array
*/
2015-02-07 13:15:40 +01:00
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
2015-02-11 07:35:10 +01:00
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
2015-02-06 05:14:27 +01:00
public function limitrepetitions()
{
2015-02-22 09:46:21 +01:00
return $this->hasManyThrough('FireflyIII\Models\LimitRepetition', 'FireflyIII\Models\BudgetLimit', 'budget_id');
2015-02-06 05:14:27 +01:00
}
2015-02-11 07:35:10 +01:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
2015-02-06 05:14:27 +01:00
public function transactionjournals()
{
2015-02-06 05:35:00 +01:00
return $this->belongsToMany('FireflyIII\Models\TransactionJournal', 'budget_transaction_journal', 'budget_id');
2015-02-06 05:14:27 +01:00
}
2015-02-11 07:35:10 +01:00
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
2015-02-06 05:14:27 +01:00
public function user()
{
2015-02-06 05:35:00 +01:00
return $this->belongsTo('FireflyIII\User');
2015-02-06 05:14:27 +01:00
}
2015-02-06 04:52:16 +01:00
}