Skip to content

Commit

Permalink
added employee scope
Browse files Browse the repository at this point in the history
  • Loading branch information
denisdulici committed May 2, 2023
1 parent d2109f4 commit 039bfcc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions app/Models/Common/Contact.php
Expand Up @@ -171,6 +171,17 @@ public function scopeCustomer($query)
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)
{
return $query->where('email', '=', $email);
Expand Down

0 comments on commit 039bfcc

Please sign in to comment.