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

@ -84,7 +84,7 @@ class Category extends Model
return $query;
}
return $query->whereIn($this->table . '.type', (array) $types);
return $query->whereIn($this->qualifyColumn('type'), (array) $types);
}
/**
@ -95,7 +95,7 @@ class Category extends Model
*/
public function scopeIncome($query)
{
return $query->where($this->table . '.type', '=', 'income');
return $query->where($this->qualifyColumn('type'), '=', 'income');
}
/**
@ -106,7 +106,7 @@ class Category extends Model
*/
public function scopeExpense($query)
{
return $query->where($this->table . '.type', '=', 'expense');
return $query->where($this->qualifyColumn('type'), '=', 'expense');
}
/**
@ -117,7 +117,7 @@ class Category extends Model
*/
public function scopeItem($query)
{
return $query->where($this->table . '.type', '=', 'item');
return $query->where($this->qualifyColumn('type'), '=', 'item');
}
/**
@ -128,7 +128,7 @@ class Category extends Model
*/
public function scopeOther($query)
{
return $query->where($this->table . '.type', '=', 'other');
return $query->where($this->qualifyColumn('type'), '=', 'other');
}
public function scopeName($query, $name)

View File

@ -180,7 +180,7 @@ class Currency extends Model
*/
public function scopeCode($query, $code)
{
return $query->where($this->table . '.code', $code);
return $query->where($this->qualifyColumn('code'), $code);
}
/**

View File

@ -77,6 +77,6 @@ class Setting extends Eloquent
*/
public function scopeCompanyId($query, $company_id)
{
return $query->where($this->table . '.company_id', '=', $company_id);
return $query->where($this->qualifyColumn('company_id'), '=', $company_id);
}
}

View File

@ -84,37 +84,37 @@ class Tax extends Model
return $query;
}
return $query->whereIn($this->table . '.type', (array) $types);
return $query->whereIn($this->qualifyColumn('type'), (array) $types);
}
public function scopeFixed($query)
{
return $query->where($this->table . '.type', '=', 'fixed');
return $query->where($this->qualifyColumn('type'), '=', 'fixed');
}
public function scopeNormal($query)
{
return $query->where($this->table . '.type', '=', 'normal');
return $query->where($this->qualifyColumn('type'), '=', 'normal');
}
public function scopeInclusive($query)
{
return $query->where($this->table . '.type', '=', 'inclusive');
return $query->where($this->qualifyColumn('type'), '=', 'inclusive');
}
public function scopeCompound($query)
{
return $query->where($this->table . '.type', '=', 'compound');
return $query->where($this->qualifyColumn('type'), '=', 'compound');
}
public function scopeWithholding($query)
{
return $query->where($this->table . '.type', '=', 'withholding');
return $query->where($this->qualifyColumn('type'), '=', 'withholding');
}
public function scopeNotWithholding($query)
{
return $query->where($this->table . '.type', '<>', 'withholding');
return $query->where($this->qualifyColumn('type'), '<>', 'withholding');
}
/**