improved type check

This commit is contained in:
denisdulici
2020-04-11 01:32:03 +03:00
parent 246b5b6437
commit 564c80980a

View File

@ -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;