Added Ezypayment next payment check

This commit is contained in:
Deon George
2019-06-11 12:36:58 +10:00
parent c45f5136fe
commit eb254def7a
4 changed files with 107 additions and 11 deletions

View File

@@ -36,6 +36,11 @@ class Account extends Model
return $this->belongsTo(Country::class);
}
public function invoices()
{
return $this->hasMany(Invoice::class);
}
public function language()
{
return $this->belongsTo(Language::class);
@@ -114,4 +119,16 @@ class Account extends Model
return join("\n",$this->_address());
}
}
/**
* Get the due invoices on an account
*
* @return mixed
*/
public function dueInvoices()
{
return $this->invoices->filter(function($item) {
return $item->active AND $item->due > 0;
});
}
}