This commit is contained in:
Ludovic CANDELLIER
2022-11-11 13:05:40 +01:00
parent f89acd9399
commit 7df2421373
104 changed files with 1212 additions and 764 deletions

View File

@@ -9,13 +9,24 @@ class Orders
public static function saveOrder($data)
{
$data += $data['basket'];
$basket = $data['basket'];
unset($data['basket']);
dump($data);
exit;
$order = self::store($data);
$invoice = Invoices::saveInvoice($order->id, $data);
return $order ? OrderDetails::saveBasket($order->id, $basket) : false;
$detail = OrderDetails::saveBasket($order->id, $basket['detail']);
unset($data['comment']);
unset($data['agree']);
unset($data['customer_id']);
unset($data['delivery_id']);
unset($data['detail']);
unset($data['payment_type']);
unset($data['sale_channel_id']);
return ($order && $detail) ? Invoices::saveInvoice($order->id, $data) : false;
}
public static function edit($id)
{
return Orders::get($id, ['customer', 'address', 'delivery', 'detail']);
}
public static function get($id, $relations = false)
@@ -30,6 +41,7 @@ class Orders
public static function create($data)
{
OrderStats::increase();
return Order::create($data);
}