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