fix: 🐛 admin/servers sort
This commit is contained in:
parent
17ab473576
commit
aefa5ba1c8
3 changed files with 8 additions and 12 deletions
|
@ -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) {
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
{
|
||||
data: 'user',
|
||||
name: 'user.name',
|
||||
sortable: false
|
||||
},
|
||||
{
|
||||
data: 'identifier'
|
||||
|
|
|
@ -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',
|
||||
|
|
Loading…
Reference in a new issue