From 10ad86ece655eb871920a7878fbc5eb78ca5c160 Mon Sep 17 00:00:00 2001 From: igwen6w Date: Fri, 10 Feb 2023 16:37:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E9=99=8D=E5=BA=8F?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Controllers/GridSortableController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Controllers/GridSortableController.php b/src/Controllers/GridSortableController.php index e36c4db..81284e1 100644 --- a/src/Controllers/GridSortableController.php +++ b/src/Controllers/GridSortableController.php @@ -11,11 +11,13 @@ class GridSortableController extends Controller public function sort(Request $request) { $sorts = $request->get('_sort'); + $direction = $request->get('_direction'); + $_sort_method = (strtolower($direction) === 'desc') ? 'sortDesc' : 'sort'; $sorts = collect($sorts) ->pluck('key') ->combine( - collect($sorts)->pluck('sort')->sort() + collect($sorts)->pluck('sort')->$_sort_method() ); $status = true;