diff --git a/app/Models/Document/DocumentTotal.php b/app/Models/Document/DocumentTotal.php index 2498f3104..7304e83c2 100644 --- a/app/Models/Document/DocumentTotal.php +++ b/app/Models/Document/DocumentTotal.php @@ -32,6 +32,26 @@ class DocumentTotal extends Model return $this->belongsTo('App\Models\Document\Document'); } + public function scopeType(Builder $query, string $type) + { + return $query->where($this->table . '.type', '=', $type); + } + + public function scopeInvoice(Builder $query) + { + return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE); + } + + public function scopeBill(Builder $query) + { + return $query->where($this->table . '.type', '=', Document::BILL_TYPE); + } + + public function scopeCode($query, $code) + { + return $query->where('code', '=', $code); + } + public function getTitleAttribute() { $title = $this->name; @@ -70,24 +90,4 @@ class DocumentTotal extends Model return $title; } - - public function scopeType(Builder $query, string $type) - { - return $query->where($this->table . '.type', '=', $type); - } - - public function scopeInvoice(Builder $query) - { - return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE); - } - - public function scopeBill(Builder $query) - { - return $query->where($this->table . '.type', '=', Document::BILL_TYPE); - } - - public function scopeCode($query, $code) - { - return $query->where('code', '=', $code); - } }