Skip to content

Commit

Permalink
fix: 🐛 admin/servers sort
Browse files Browse the repository at this point in the history
  • Loading branch information
IceToast committed Feb 16, 2023
1 parent 17ab473 commit aefa5ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/Http/Controllers/Admin/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Log;
use Yajra\DataTables\DataTables;

class ServerController extends Controller
{
Expand Down Expand Up @@ -169,6 +170,7 @@ public function dataTable(Request $request)
{
$query = Server::with(['user', 'product']);


if ($request->has('product')) {
$query->where('product_id', '=', $request->input('product'));
}
Expand All @@ -177,10 +179,8 @@ public function dataTable(Request $request)
}
$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) {
Expand Down
1 change: 0 additions & 1 deletion themes/default/views/admin/servers/table.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function submitResult() {
{
data: 'user',
name: 'user.name',
sortable: false
},
{
data: 'identifier'
Expand Down
13 changes: 5 additions & 8 deletions themes/default/views/admin/users/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,10 @@ function submitResult() {
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,
Expand Down Expand Up @@ -115,22 +117,17 @@ function submitResult() {
},
{
data: 'servers_count'
},
{
data: 'referrals_count',
sortable: false
},
{
data: 'verified',
sortable: false
},
{
data: 'last_seen',
type: 'num',
render: {
_: 'display',
sort: 'raw'
}
},
{
data: 'actions',
Expand Down

0 comments on commit aefa5ba

Please sign in to comment.