fixed #712
This commit is contained in:
@ -83,7 +83,7 @@ class Bill extends Model
|
||||
return $this->hasMany('App\Models\Expense\BillItem');
|
||||
}
|
||||
|
||||
public function itemTaxes()
|
||||
public function item_taxes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Expense\BillItemTax');
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ class BillItem extends Model
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['company_id', 'bill_id', 'item_id', 'name', 'sku', 'quantity', 'price', 'total', 'tax', 'tax_id'];
|
||||
protected $fillable = ['company_id', 'bill_id', 'item_id', 'name', 'sku', 'quantity', 'price', 'total', 'tax'];
|
||||
|
||||
public function bill()
|
||||
{
|
||||
@ -29,16 +29,11 @@ class BillItem extends Model
|
||||
return $this->belongsTo('App\Models\Common\Item');
|
||||
}
|
||||
|
||||
public function itemTaxes()
|
||||
public function taxes()
|
||||
{
|
||||
return $this->hasMany('App\Models\Expense\BillItemTax', 'bill_item_id', 'id');
|
||||
}
|
||||
|
||||
public function tax()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Setting\Tax');
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert price to double.
|
||||
*
|
||||
@ -71,23 +66,4 @@ class BillItem extends Model
|
||||
{
|
||||
$this->attributes['tax'] = (double) $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert tax to double.
|
||||
*
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function getTaxIdAttribute($value)
|
||||
{
|
||||
$tax_ids = [];
|
||||
|
||||
if (!empty($value)) {
|
||||
$tax_ids[] = $value;
|
||||
|
||||
return $tax_ids;
|
||||
}
|
||||
|
||||
return $this->itemTaxes->pluck('tax_id');
|
||||
}
|
||||
}
|
||||
|
@ -24,11 +24,6 @@ class BillItemTax extends Model
|
||||
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');
|
||||
|
Reference in New Issue
Block a user