used qualifyColumn to prefix columns
This commit is contained in:
		@@ -103,7 +103,7 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
     */
 | 
			
		||||
    public function scopeCompanyId($query, $company_id)
 | 
			
		||||
    {
 | 
			
		||||
        return $query->where($this->table . '.company_id', '=', $company_id);
 | 
			
		||||
        return $query->where($this->getTable() . '.company_id', '=', $company_id);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -177,7 +177,7 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
     */
 | 
			
		||||
    public function scopeEnabled($query)
 | 
			
		||||
    {
 | 
			
		||||
        return $query->where($this->table . '.enabled', 1);
 | 
			
		||||
        return $query->where($this->qualifyColumn('enabled'), 1);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -188,7 +188,7 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
     */
 | 
			
		||||
    public function scopeDisabled($query)
 | 
			
		||||
    {
 | 
			
		||||
        return $query->where($this->table . '.enabled', 0);
 | 
			
		||||
        return $query->where($this->qualifyColumn('enabled'), 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -200,7 +200,7 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
     */
 | 
			
		||||
    public function scopeReconciled($query, $value = 1)
 | 
			
		||||
    {
 | 
			
		||||
        return $query->where($this->table . '.reconciled', $value);
 | 
			
		||||
        return $query->where($this->qualifyColumn('reconciled'), $value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function scopeAccount($query, $accounts)
 | 
			
		||||
@@ -209,7 +209,7 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
            return $query;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $query->whereIn($this->table . '.account_id', (array) $accounts);
 | 
			
		||||
        return $query->whereIn($this->qualifyColumn('account_id'), (array) $accounts);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function scopeContact($query, $contacts)
 | 
			
		||||
@@ -218,22 +218,22 @@ abstract class Model extends Eloquent implements Ownable
 | 
			
		||||
            return $query;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $query->whereIn($this->table . '.contact_id', (array) $contacts);
 | 
			
		||||
        return $query->whereIn($this->qualifyColumn('contact_id'), (array) $contacts);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user