Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Bottelet/DaybydayCRM

2311 stars
2 code files
View Bottelet/DaybydayCRM on GitHub

app/Enums/InvoiceStatus.php

Open in GitHub
class InvoiceStatus
{
private const DRAFT = 'draft';
private const CLOSED = 'closed';
private const SENT = 'sent';
private const UNPAID = 'unpaid';
private const PARTIAL_PAID = 'partial_paid';
private const PAID = 'paid';
private const OVERPAID = 'overpaid';
//
}

app/Services/Invoice/GenerateInvoiceStatus.php

Open in GitHub
use App\Enums\InvoiceStatus;
use App\Models\Invoice;
use App\Repositories\Money\Money;
 
class GenerateInvoiceStatus
{
//
public function getStatus()
{
if ($this->isDraft()) {
return InvoiceStatus::draft()->getStatus();
}
if ($this->isUnPaid()) {
return InvoiceStatus::unpaid()->getStatus();
}
if ($this->isPaid()) {
return InvoiceStatus::paid()->getStatus();
}
if ($this->isPartialPaid()) {
return InvoiceStatus::partialPaid()->getStatus();
}
if ($this->isOverPaid()) {
return InvoiceStatus::overpaid()->getStatus();
}
throw new \Exception("Can't generate invoice status for invoice: " . $this->invoice->id);
}
//
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.