static function pagination($order, $num) { $colltions = []; $length = Redis::HLEN(config('queue-managers.name')); if ($length > 0) { $arrray = Redis::HVALS(config('queue-managers.name')); if (count($arrray > 0)) { $jobs = []; if (!empty($order)) { $arrray = self::sort($arrray, $order); foreach ($arrray as $value) { if (!empty($value)) { $jobs[] = QueueJob::toBase($value); } else { return []; } } } else { foreach ($arrray as $value) { if (!empty($value)) { $jobArray = json_decode($value); $jobs[] = QueueJob::toBase($jobArray); } else { return []; } } } $colltion = collect($jobs); $colltions = $colltion->forPage(request('page') ? request('page') : 1, 10); } } return new LengthAwarePaginator($colltions, $length, $num, request('page') ? request('page') : 1, ['path' => Paginator::resolveCurrentPath(), 'pageName' => 'page']); }