close #861 Fixed: Sending an invoice sets the wrong "sent date"

This commit is contained in:
Cüneyt Şentürk
2020-03-25 18:09:52 +03:00
parent d8d27c2ba6
commit ee6041ecd1
4 changed files with 18 additions and 4 deletions

View File

@ -108,4 +108,11 @@ class Invoice extends DocumentModel
$this->status = 'draft';
$this->invoice_number = $this->getNextInvoiceNumber();
}
public function getSentAtAttribute($value)
{
$sent = $this->histories()->where('status', 'sent')->first();
return ($sent) ? $sent->created_at : null;
}
}