added employee scope

This commit is contained in:
Denis Duliçi 2023-05-02 11:21:36 +03:00
parent d2109f4fce
commit 039bfccd7a

View File

@ -171,6 +171,17 @@ class Contact extends Model
return $query->whereIn($this->qualifyColumn('type'), (array) $this->getCustomerTypes()); return $query->whereIn($this->qualifyColumn('type'), (array) $this->getCustomerTypes());
} }
/**
* Scope to include only employees.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public function scopeEmployee($query)
{
return $query->whereIn($this->qualifyColumn('type'), (array) $this->getEmployeeTypes());
}
public function scopeEmail($query, $email) public function scopeEmail($query, $email)
{ {
return $query->where('email', '=', $email); return $query->where('email', '=', $email);