weizong song 5 years ago
parent b09b110520
commit 9ec3cfd986

@ -332,6 +332,8 @@ class OrdersController extends CommonController
{ {
DB::beginTransaction(); DB::beginTransaction();
$request = request(); $request = request();
try {
$has_orders = Orders::where("customer_id", $this->customer->id)->whereIn("status", [Orders::STATUS_UNCONFIRMED, Orders::STATUS_UNASSIGNED, Orders::STATUS_ONGOING])->count(); $has_orders = Orders::where("customer_id", $this->customer->id)->whereIn("status", [Orders::STATUS_UNCONFIRMED, Orders::STATUS_UNASSIGNED, Orders::STATUS_ONGOING])->count();
if ($has_orders) { if ($has_orders) {
return response()->json([ return response()->json([
@ -361,6 +363,7 @@ class OrdersController extends CommonController
"name" => $request->patient_name, "name" => $request->patient_name,
"sex" => $request->patient_sex "sex" => $request->patient_sex
]); ]);
dd($patient);
$order = (new Orders())->create([ $order = (new Orders())->create([
"customer_id" => $this->customer->id, "customer_id" => $this->customer->id,
@ -380,8 +383,6 @@ class OrdersController extends CommonController
]); ]);
$order->getSerial(); $order->getSerial();
try {
DB::commit(); DB::commit();
return $this->getOrder($order->id); return $this->getOrder($order->id);
} catch (\Exception $exception) { } catch (\Exception $exception) {

Loading…
Cancel
Save