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

@ -557,17 +557,17 @@ class Company extends Eloquent implements Ownable
public function scopeSource($query, $source)
{
return $query->where($this->table . '.created_from', $source);
return $query->where($this->qualifyColumn('created_from'), $source);
}
public function scopeIsOwner($query)
{
return $query->where($this->table . '.created_by', user_id());
return $query->where($this->qualifyColumn('created_by'), user_id());
}
public function scopeIsNotOwner($query)
{
return $query->where($this->table . '.created_by', '<>', user_id());
return $query->where($this->qualifyColumn('created_by'), '<>', user_id());
}
public function ownerKey($owner)

View File

@ -133,7 +133,7 @@ class Contact extends Model
return $query;
}
return $query->whereIn($this->table . '.type', (array) $types);
return $query->whereIn($this->qualifyColumn('type'), (array) $types);
}
/**
@ -144,7 +144,7 @@ class Contact extends Model
*/
public function scopeVendor($query)
{
return $query->whereIn($this->table . '.type', (array) $this->getVendorTypes());
return $query->whereIn($this->qualifyColumn('type'), (array) $this->getVendorTypes());
}
/**
@ -155,7 +155,7 @@ class Contact extends Model
*/
public function scopeCustomer($query)
{
return $query->whereIn($this->table . '.type', (array) $this->getCustomerTypes());
return $query->whereIn($this->qualifyColumn('type'), (array) $this->getCustomerTypes());
}
public function scopeEmail($query, $email)