close #1340 Fixed: Missing edit invoice and bill item taxes.
This commit is contained in:
@ -27,6 +27,15 @@ class BillItem extends Model
|
||||
*/
|
||||
public $cloneable_relations = ['taxes'];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::retrieved(function($model) {
|
||||
$model->setTaxIds();
|
||||
});
|
||||
}
|
||||
|
||||
public function bill()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Purchase\Bill');
|
||||
@ -74,4 +83,20 @@ class BillItem extends Model
|
||||
{
|
||||
$this->attributes['tax'] = (double) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert tax to Array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setTaxIds()
|
||||
{
|
||||
$tax_ids = [];
|
||||
|
||||
foreach ($this->taxes as $tax) {
|
||||
$tax_ids[] = (string) $tax->tax_id;
|
||||
}
|
||||
|
||||
$this->setAttribute('tax_id', $tax_ids);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user