akaunting/app/Models/Banking/Transfer.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2017-09-14 22:21:00 +03:00
<?php
namespace App\Models\Banking;
2019-11-16 10:21:14 +03:00
use App\Abstracts\Model;
2017-09-14 22:21:00 +03:00
use App\Traits\Currencies;
class Transfer extends Model
{
use Currencies;
protected $table = 'transfers';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
2019-11-16 10:21:14 +03:00
protected $fillable = ['company_id', 'expense_transaction_id', 'income_transaction_id'];
2017-09-14 22:21:00 +03:00
/**
* Sortable columns.
*
* @var array
*/
2019-11-16 10:21:14 +03:00
public $sortable = ['expense.paid_at', 'expense.amount', 'expense.name', 'income.name'];
2017-09-14 22:21:00 +03:00
2019-11-16 10:21:14 +03:00
public function expense_transaction()
2017-09-14 22:21:00 +03:00
{
2019-11-16 10:21:14 +03:00
return $this->belongsTo('App\Models\Banking\Transaction', 'expense_transaction_id');
2017-09-14 22:21:00 +03:00
}
2019-11-16 10:21:14 +03:00
public function expense_account()
2017-09-14 22:21:00 +03:00
{
2019-11-16 10:21:14 +03:00
return $this->belongsTo('App\Models\Banking\Account', 'expense_transaction.account_id', 'id');
2017-09-14 22:21:00 +03:00
}
2019-11-16 10:21:14 +03:00
public function income_transaction()
2017-09-14 22:21:00 +03:00
{
2019-11-16 10:21:14 +03:00
return $this->belongsTo('App\Models\Banking\Transaction', 'income_transaction_id');
2017-09-14 22:21:00 +03:00
}
2019-11-16 10:21:14 +03:00
public function income_account()
2017-09-14 22:21:00 +03:00
{
2019-11-16 10:21:14 +03:00
return $this->belongsTo('App\Models\Banking\Account', 'income_transaction.account_id', 'id');
}
2017-09-14 22:21:00 +03:00
}