used qualifyColumn to prefix columns

This commit is contained in:
Denis Duliçi
2021-09-10 09:41:15 +03:00
parent f77b6475ff
commit 91907067a2
14 changed files with 50 additions and 50 deletions

View File

@ -172,17 +172,17 @@ class Document extends Model
public function scopeType(Builder $query, string $type)
{
return $query->where($this->table . '.type', '=', $type);
return $query->where($this->qualifyColumn('type'), '=', $type);
}
public function scopeInvoice(Builder $query)
{
return $query->where($this->table . '.type', '=', self::INVOICE_TYPE);
return $query->where($this->qualifyColumn('type'), '=', self::INVOICE_TYPE);
}
public function scopeBill(Builder $query)
{
return $query->where($this->table . '.type', '=', self::BILL_TYPE);
return $query->where($this->qualifyColumn('type'), '=', self::BILL_TYPE);
}
/**

View File

@ -22,16 +22,16 @@ class DocumentHistory extends Model
public function scopeType(Builder $query, string $type)
{
return $query->where($this->table . '.type', '=', $type);
return $query->where($this->qualifyColumn('type'), '=', $type);
}
public function scopeInvoice(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::INVOICE_TYPE);
}
public function scopeBill(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::BILL_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::BILL_TYPE);
}
}

View File

@ -78,17 +78,17 @@ class DocumentItem extends Model
public function scopeType(Builder $query, string $type)
{
return $query->where($this->table . '.type', '=', $type);
return $query->where($this->qualifyColumn('type'), '=', $type);
}
public function scopeInvoice(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::INVOICE_TYPE);
}
public function scopeBill(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::BILL_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::BILL_TYPE);
}
public function getDiscountAttribute(): string

View File

@ -41,16 +41,16 @@ class DocumentItemTax extends Model
public function scopeType(Builder $query, string $type)
{
return $query->where($this->table . '.type', '=', $type);
return $query->where($this->qualifyColumn('type'), '=', $type);
}
public function scopeInvoice(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::INVOICE_TYPE);
}
public function scopeBill(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::BILL_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::BILL_TYPE);
}
}

View File

@ -34,17 +34,17 @@ class DocumentTotal extends Model
public function scopeType(Builder $query, string $type)
{
return $query->where($this->table . '.type', '=', $type);
return $query->where($this->qualifyColumn('type'), '=', $type);
}
public function scopeInvoice(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::INVOICE_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::INVOICE_TYPE);
}
public function scopeBill(Builder $query)
{
return $query->where($this->table . '.type', '=', Document::BILL_TYPE);
return $query->where($this->qualifyColumn('type'), '=', Document::BILL_TYPE);
}
public function scopeCode($query, $code)