From 8a99e58fe1d4067073fee7f2d55ef6f676d09305 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 4 Nov 2019 02:06:21 +0800 Subject: [PATCH] update --- app/Http/Controllers/Admin/OrderController.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/OrderController.php b/app/Http/Controllers/Admin/OrderController.php index 7a9df8b2..2992e6b4 100644 --- a/app/Http/Controllers/Admin/OrderController.php +++ b/app/Http/Controllers/Admin/OrderController.php @@ -6,6 +6,7 @@ use Illuminate\Http\Request; use App\Http\Controllers\Controller; use App\Models\Order; use App\Models\User; +use App\Models\Plan; class OrderController extends Controller { @@ -17,9 +18,18 @@ class OrderController extends Controller $orderModel->where('trade_no', $request->input('trade_no')); } $total = $orderModel->count(); + $res = $orderModel->forPage($current, $pageSize) + ->get(); + $plan = Plan::get(); + for ($i = 0; $i < count($res); $i++) { + for ($k = 0; $k < count($plan); $k++) { + if ($plan[$k]['id'] == $res[$i]['plan_id']) { + $res[$i]['plan_name'] = $plan[$k]['name']; + } + } + } return response([ - 'data' => $orderModel->forPage($current, $pageSize) - ->get(), + 'data' => $res, 'total' => $total ]); }