Merge Invoice and Bill into Document

This commit is contained in:
Burak Çakırel
2020-12-24 01:28:38 +03:00
parent 830cc05957
commit 0c1424db47
436 changed files with 31655 additions and 37350 deletions

View File

@ -3,6 +3,7 @@
namespace App\Models\Setting;
use App\Abstracts\Model;
use App\Models\Document\Document;
use Illuminate\Database\Eloquent\Factories\HasFactory;
class Tax extends Model
@ -47,14 +48,19 @@ class Tax extends Model
return $this->hasMany('App\Models\Common\Item');
}
public function document_items()
{
return $this->hasMany('App\Models\Document\DocumentItemTax');
}
public function bill_items()
{
return $this->hasMany('App\Models\Purchase\BillItemTax');
return $this->document_items()->where('type', Document::BILL_TYPE);
}
public function invoice_items()
{
return $this->hasMany('App\Models\Sale\InvoiceItemTax');
return $this->document_items()->where('type', Document::INVOICE_TYPE);
}
public function scopeName($query, $name)