From aefa5ba1c868f1a3da86fd491678af1d98f98b85 Mon Sep 17 00:00:00 2001 From: IceToast Date: Thu, 16 Feb 2023 00:18:42 +0100 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20admin/servers=20sort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Controllers/Admin/ServerController.php | 6 +++--- themes/default/views/admin/servers/table.blade.php | 1 - themes/default/views/admin/users/index.blade.php | 13 +++++-------- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/Http/Controllers/Admin/ServerController.php b/app/Http/Controllers/Admin/ServerController.php index 14b594ab..85203916 100644 --- a/app/Http/Controllers/Admin/ServerController.php +++ b/app/Http/Controllers/Admin/ServerController.php @@ -16,6 +16,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Support\Facades\Log; +use Yajra\DataTables\DataTables; class ServerController extends Controller { @@ -169,6 +170,7 @@ class ServerController extends Controller { $query = Server::with(['user', 'product']); + if ($request->has('product')) { $query->where('product_id', '=', $request->input('product')); } @@ -177,10 +179,8 @@ class ServerController extends Controller } $query->select('servers.*'); + Log::info($request->input('order')); - if ($request->has('order')) { - $query = $this->sortByColumn($request->input('order'), $request->input('columns'), $query); - } return datatables($query) ->addColumn('user', function (Server $server) { diff --git a/themes/default/views/admin/servers/table.blade.php b/themes/default/views/admin/servers/table.blade.php index 219ef47c..29d080fd 100644 --- a/themes/default/views/admin/servers/table.blade.php +++ b/themes/default/views/admin/servers/table.blade.php @@ -43,7 +43,6 @@ { data: 'user', name: 'user.name', - sortable: false }, { data: 'identifier' diff --git a/themes/default/views/admin/users/index.blade.php b/themes/default/views/admin/users/index.blade.php index de2dc76e..c1912185 100644 --- a/themes/default/views/admin/users/index.blade.php +++ b/themes/default/views/admin/users/index.blade.php @@ -80,8 +80,10 @@ processing: true, serverSide: true, //why was this set to false before? increased loadingtimes by 10 seconds stateSave: true, - ajax: "{{ route('admin.users.datatable') }}", - + ajax: "{{ route('admin.users.datatable') }}{{ $filter ?? '' }}", + order: [ + [11, "desc"] + ], columns: [{ data: 'discordId', visible: false, @@ -115,10 +117,10 @@ }, { data: 'servers_count' + }, { data: 'referrals_count', - sortable: false }, { data: 'verified', @@ -126,11 +128,6 @@ }, { data: 'last_seen', - type: 'num', - render: { - _: 'display', - sort: 'raw' - } }, { data: 'actions',