From e715ec6b0193030e110bafe5e2725e58d00d28d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20Duli=C3=A7i?= Date: Mon, 8 Jun 2020 23:40:04 +0300 Subject: [PATCH] fixed tests --- app/Traits/Contacts.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Traits/Contacts.php b/app/Traits/Contacts.php index f0f6368b5..df7cb3d2c 100644 --- a/app/Traits/Contacts.php +++ b/app/Traits/Contacts.php @@ -6,12 +6,16 @@ trait Contacts { public function isCustomer() { - return in_array($this->type, $this->getCustomerTypes()); + $type = $this->type ?? $this->contact->type ?? 'customer'; + + return in_array($type, $this->getCustomerTypes()); } public function isVendor() { - return in_array($this->type, $this->getVendorTypes()); + $type = $this->type ?? $this->contact->type ?? 'vendor'; + + return in_array($type, $this->getVendorTypes()); } public function getCustomerTypes($return = 'array')