From 564c80980ab9021e373717cc543f561b18f077b6 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Sat, 11 Apr 2020 01:32:03 +0300 Subject: [PATCH] improved type check --- app/Models/Common/Contact.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Models/Common/Contact.php b/app/Models/Common/Contact.php index 6506a98b0..5b4ceaaa3 100644 --- a/app/Models/Common/Contact.php +++ b/app/Models/Common/Contact.php @@ -132,7 +132,7 @@ class Contact extends Model { $amount = 0; - $collection = ($this->type == 'customer') ? 'invoices' : 'bills'; + $collection = in_array($this->type, $this->getCustomerTypes()) ? 'invoices' : 'bills'; $this->$collection()->accrued()->notPaid()->each(function ($item) use (&$amount) { $unpaid = $item->amount - $item->paid;