akaunting/app/Models/Sale/InvoiceItemTax.php

43 lines
811 B
PHP
Raw Normal View History

<?php
2019-12-31 15:49:09 +03:00
namespace App\Models\Sale;
2019-11-16 10:21:14 +03:00
use App\Abstracts\Model;
use App\Traits\Currencies;
class InvoiceItemTax extends Model
{
use Currencies;
protected $table = 'invoice_item_taxes';
/**
* Attributes that should be mass-assignable.
*
* @var array
*/
protected $fillable = ['company_id', 'invoice_id', 'invoice_item_id', 'tax_id', 'name', 'amount'];
public function invoice()
{
2019-12-31 15:49:09 +03:00
return $this->belongsTo('App\Models\Sale\Invoice');
}
public function tax()
{
return $this->belongsTo('App\Models\Setting\Tax');
}
/**
* Convert amount to double.
*
* @param string $value
* @return void
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = (double) $value;
}
}