firefly-iii/app/Models/TransactionJournal.php

72 lines
1.4 KiB
PHP
Raw Normal View History

2015-02-05 21:52:16 -06:00
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
2015-02-05 22:04:06 -06:00
class TransactionJournal extends Model
{
2015-02-05 21:52:16 -06:00
2015-02-05 22:14:27 -06:00
public function bill()
{
return $this->belongsTo('Bill');
}
public function budgets()
{
return $this->belongsToMany('Budget');
}
public function categories()
{
return $this->belongsToMany('Category');
}
public function getDescriptionAttribute($value)
{
if ($this->encrypted) {
return Crypt::decrypt($value);
}
// @codeCoverageIgnoreStart
return $value;
// @codeCoverageIgnoreEnd
}
public function piggyBankEvents()
{
return $this->hasMany('PiggyBankEvent');
}
public function setDescriptionAttribute($value)
{
$this->attributes['description'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
public function transactionCurrency()
{
return $this->belongsTo('TransactionCurrency');
}
public function transactionType()
{
return $this->belongsTo('TransactionType');
}
public function transactiongroups()
{
return $this->belongsToMany('TransactionGroup');
}
public function transactions()
{
return $this->hasMany('Transaction');
}
public function user()
{
return $this->belongsTo('User');
}
2015-02-05 21:52:16 -06:00
}