2014-07-05 12:44:26 -05:00
|
|
|
<?php
|
|
|
|
|
2014-12-16 14:41:16 -06:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletingTrait;
|
|
|
|
|
2014-12-13 14:59:02 -06:00
|
|
|
/**
|
|
|
|
* Class Budget
|
|
|
|
*/
|
2014-12-17 13:47:46 -06:00
|
|
|
class Budget extends Eloquent
|
2014-07-20 11:24:27 -05:00
|
|
|
{
|
2014-12-16 14:41:16 -06:00
|
|
|
use SoftDeletingTrait;
|
2014-12-17 13:47:46 -06:00
|
|
|
protected $fillable = ['name', 'user_id'];
|
2014-07-05 12:44:26 -05:00
|
|
|
|
2014-12-13 14:59:02 -06:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
|
|
|
*/
|
2014-11-21 04:11:52 -06:00
|
|
|
public function limitrepetitions()
|
|
|
|
{
|
2014-12-17 13:47:46 -06:00
|
|
|
return $this->hasManyThrough('LimitRepetition', 'BudgetLimit', 'budget_id');
|
2014-11-21 04:11:52 -06:00
|
|
|
}
|
|
|
|
|
2014-08-10 11:22:42 -05:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
2014-12-13 14:59:02 -06:00
|
|
|
public function budgetlimits()
|
2014-07-20 11:24:27 -05:00
|
|
|
{
|
2014-12-17 13:47:46 -06:00
|
|
|
return $this->hasMany('BudgetLimit', 'budget_id');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
|
|
|
*/
|
|
|
|
public function transactionjournals()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('TransactionJournal', 'budget_transaction_journal', 'budget_id');
|
2014-07-20 11:24:27 -05:00
|
|
|
}
|
|
|
|
|
2014-12-17 13:47:46 -06:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->belongsTo('User');
|
|
|
|
}
|
2014-07-05 12:44:26 -05:00
|
|
|
|
|
|
|
}
|