From af92b1d6a0958f751b04f6202cde2b38108c2e85 Mon Sep 17 00:00:00 2001 From: Nuradiyana Date: Thu, 4 Jan 2024 20:26:39 +0700 Subject: [PATCH] Tambah order by dan jumlah row --- src/Actions/FetchUserUploadFilePaginator.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Actions/FetchUserUploadFilePaginator.php b/src/Actions/FetchUserUploadFilePaginator.php index 3a6fbd4..75208f5 100644 --- a/src/Actions/FetchUserUploadFilePaginator.php +++ b/src/Actions/FetchUserUploadFilePaginator.php @@ -16,6 +16,7 @@ public function handle(Request $request, ?string $modelType = null): CursorPagin $keyword = $request->string('keyword'); return ModelUploadFile::query() + ->withCount('records') ->when($keyword, function (Builder $builder) use ($keyword): void { $value = \mb_strtolower((string) $keyword, 'UTF8'); @@ -23,6 +24,7 @@ public function handle(Request $request, ?string $modelType = null): CursorPagin }) ->when($modelType, fn (Builder $builder) => $builder->where('model_type', $modelType)) ->where('user_id', $request->user()?->getKey()) + ->latest() ->cursorPaginate() ->withQueryString(); }