human friendly invoice import/export

This commit is contained in:
denisdulici
2020-01-20 22:58:49 +03:00
parent 8562223ff3
commit 6923a3d6e4
27 changed files with 497 additions and 76 deletions

View File

@ -36,12 +36,12 @@ class Item extends Model
public function category()
{
return $this->belongsTo('App\Models\Setting\Category');
return $this->belongsTo('App\Models\Setting\Category')->withDefault(['name' => trans('general.na')]);
}
public function tax()
{
return $this->belongsTo('App\Models\Setting\Tax');
return $this->belongsTo('App\Models\Setting\Tax')->withDefault(['name' => trans('general.na')]);
}
public function bill_items()
@ -54,6 +54,11 @@ class Item extends Model
return $this->hasMany('App\Models\Sale\InvoiceItem');
}
public function scopeName($query, $name)
{
return $query->where('name', '=', $name);
}
/**
* Convert sale price to double.
*