From d4d76256f13ea5072dfaf42f7415982b0a36607f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=8E=E6=B2=A1=E5=BC=80=E5=A7=8B?= <506907958@qq.com> Date: Mon, 16 Sep 2019 17:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E6=89=BE=E4=B8=8D=E5=88=B0=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/NavController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Http/Controllers/Admin/NavController.php b/app/Http/Controllers/Admin/NavController.php index dd2620c5..201229d6 100644 --- a/app/Http/Controllers/Admin/NavController.php +++ b/app/Http/Controllers/Admin/NavController.php @@ -129,4 +129,19 @@ public function forceDelete($id) return redirect('admin/nav/index'); } + + public function sort(Request $request, Nav $navModel) + { + $data = $request->except('_token'); + $sortData = []; + foreach ($data as $k => $v) { + $sortData[] = [ + 'id' => $k, + 'sort' => $v, + ]; + } + $navModel->updateBatch($sortData); + + return redirect()->back(); + } } -- Gitee