1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

invoice repo doc

This commit is contained in:
David Bomba 2019-05-09 08:47:38 +10:00
parent ca71819086
commit 79ed18d9ff

View File

@ -13,11 +13,25 @@ class InvoiceRepository extends BaseRepository
{ {
/**
* Gets the class name.
*
* @return ::class The class name.
*/
public function getClassName() public function getClassName()
{ {
return Invoice::class; return Invoice::class;
} }
/**
* Saves the invoices
*
* @param array. $data The invoice data
* @param InvoiceCalc|\App\Models\Invoice $invoice The invoice
*
* @return Invoice|InvoiceCalc|\App\Models\Invoice|null Returns the invoice object
*/
public function save($data, Invoice $invoice) : ?Invoice public function save($data, Invoice $invoice) : ?Invoice
{ {
$invoice->fill($data); $invoice->fill($data);
@ -35,4 +49,25 @@ class InvoiceRepository extends BaseRepository
return $invoice; return $invoice;
} }
/**
* Mark the invoice as sent.
*
* @param \App\Models\Invoice $invoice The invoice
*
* @return Invoice|\App\Models\Invoice|null Return the invoice object
*/
public function markSent(Invoice $invoice) : ?Invoice
{
if($invoice->status_id >= Invoice::STATUS_SENT)
return;
$invoice->status_id = Invoice::STATUS_SENT;
$invoice->save();
return $invoice;
}
} }