restart
This commit is contained in:
@@ -8,12 +8,9 @@ use App\Models\Shop\Invoice;
|
||||
|
||||
class Invoices
|
||||
{
|
||||
|
||||
public static function saveInvoice($order_id, $data)
|
||||
{
|
||||
$data['order_id'] = $order_id;
|
||||
dump($data);
|
||||
exit;
|
||||
return self::store($data);
|
||||
}
|
||||
|
||||
@@ -29,6 +26,7 @@ class Invoices
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
InvoiceStats::increase($data['total_taxed']);
|
||||
$data['uuid'] = Str::uuid()->toString();
|
||||
$data['ref'] = self::getNewRef();
|
||||
return Invoice::create($data);
|
||||
@@ -44,6 +42,8 @@ class Invoices
|
||||
|
||||
public static function delete($id)
|
||||
{
|
||||
$invoice = self::get($id);
|
||||
InvoiceStats::decrease($invoice->total_priced);
|
||||
return Invoice::destroy($id);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ class Invoices
|
||||
{
|
||||
$ref = date('ym') . '00000';
|
||||
$last_ref = Invoice::orderBy('ref', 'desc')->where('ref', '>', $ref)->first();
|
||||
return $last_ref ? $last_ref + 1 : $ref + 1;
|
||||
return $last_ref ? $last_ref->ref + 1 : $ref + 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user