Invoice create invocie item multible tax

This commit is contained in:
cuneytsenturk
2018-10-22 15:53:56 +03:00
parent 39e6e0b07c
commit 7f9239e602
8 changed files with 202 additions and 52 deletions

View File

@ -83,6 +83,11 @@ class Invoice extends Model
return $this->hasMany('App\Models\Income\InvoiceItem');
}
public function itemTaxes()
{
return $this->hasMany('App\Models\Income\InvoiceItemTax');
}
public function histories()
{
return $this->hasMany('App\Models\Income\InvoiceHistory');

View File

@ -0,0 +1,47 @@
<?php
namespace App\Models\Income;
use App\Models\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()
{
return $this->belongsTo('App\Models\Income\Invoice');
}
public function item()
{
return $this->belongsTo('App\Models\Common\Item');
}
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;
}
}