document total styling

This commit is contained in:
Cüneyt Şentürk 2020-12-24 12:02:22 +03:00
parent f80ab42d7a
commit fc3a5d0d0f

View File

@ -32,6 +32,26 @@ class DocumentTotal extends Model
return $this->belongsTo('App\Models\Document\Document'); 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() public function getTitleAttribute()
{ {
$title = $this->name; $title = $this->name;
@ -70,24 +90,4 @@ class DocumentTotal extends Model
return $title; 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);
}
} }