// 1 here we will create collection from querybuilder using get methode
// 2 we will use sortBy or sortByDesc methode for ordering the collection
// 3 crete manual paginator
$myQueryPagination = $query->get()
->sortByDesc(
function ($mySortByJson) {
$myQueryPagination = isset(json_decode($mySortByJson->datadaftarpolirj_json, true)['eresep']) ? 1 : 0;
return ($myQueryPagination . $mySortByJson->rj_date1);
}
);
$myQueryPagination = $this->paginate($myQueryPagination, $this->limitPerPage);