mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 11:41:09 -04:00
add previous status method in invoice model
This commit is contained in:
@ -113,6 +113,19 @@ class Invoice extends Model
|
||||
return $this->belongsTo(InvoiceTemplate::class);
|
||||
}
|
||||
|
||||
public function getPreviousStatus()
|
||||
{
|
||||
if ($this->due_date < Carbon::now()) {
|
||||
return self::STATUS_OVERDUE;
|
||||
} elseif ($this->viewed) {
|
||||
return self::STATUS_VIEWED;
|
||||
} elseif ($this->sent) {
|
||||
return self::STATUS_SENT;
|
||||
} else {
|
||||
return self::STATUS_DRAFT;
|
||||
}
|
||||
}
|
||||
|
||||
private function strposX($haystack, $needle, $number)
|
||||
{
|
||||
if ($number == '1') {
|
||||
|
||||
Reference in New Issue
Block a user