From 039bfccd7a4e6fdec9d4bcd8477a47eda79368bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Tue, 2 May 2023 11:21:36 +0300 Subject: [PATCH] added employee scope --- app/Models/Common/Contact.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/Models/Common/Contact.php b/app/Models/Common/Contact.php index db3b4f96afd..7fffcf438d5 100644 --- a/app/Models/Common/Contact.php +++ b/app/Models/Common/Contact.php @@ -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);