BillHistory.php
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace App\Models\Expense;
use App\Models\Model;
use App\Traits\Currencies;
class BillHistory extends Model
{
use Currencies;
protected $table = 'bill_histories';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'bill_id', 'status_code', 'notify', 'description'];
public function bill()
{
return $this->belongsTo('App\Models\Expense\Bill');
}
public function item()
{
return $this->belongsTo('App\Models\Common\Item');
}
public function tax()
{
return $this->belongsTo('App\Models\Setting\Tax');
}
public function payment()
{
return $this->belongsTo('App\Models\Setting\Payment');
}
public function status()
{
return $this->belongsTo('App\Models\Expense\BillStatus', 'status_code', 'code');
}
public function getConvertedAmount($format = false)
{
return $this->convert($this->amount, $this->currency_code, $this->currency_rate, $format);
}
}