Service paid_to can be null if no invoices created yet
This commit is contained in:
parent
319fa32754
commit
b065d15f60
@ -826,10 +826,13 @@ class Service extends Model implements IDs
|
|||||||
/**
|
/**
|
||||||
* Work out when this service has been paid to.
|
* Work out when this service has been paid to.
|
||||||
*
|
*
|
||||||
* @return Carbon
|
* @return Carbon|null
|
||||||
*/
|
*/
|
||||||
public function getPaidToAttribute(): Carbon
|
public function getPaidToAttribute(): ?Carbon
|
||||||
{
|
{
|
||||||
|
if (! $this->invoices->count())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
foreach ($this->invoices->reverse() as $o)
|
foreach ($this->invoices->reverse() as $o)
|
||||||
if ($o->due == 0)
|
if ($o->due == 0)
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user