Skip to content

Commit 26bf8e0

Browse files
authored
Merge pull request #11 from atfromhome/patch-update
Tambah order by dan jumlah row
2 parents 25cb61e + af92b1d commit 26bf8e0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/Actions/FetchUserUploadFilePaginator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ public function handle(Request $request, ?string $modelType = null): CursorPagin
1616
$keyword = $request->string('keyword');
1717

1818
return ModelUploadFile::query()
19+
->withCount('records')
1920
->when($keyword, function (Builder $builder) use ($keyword): void {
2021
$value = \mb_strtolower((string) $keyword, 'UTF8');
2122

2223
$builder->orWhereRaw('LOWER(file_name) LIKE ?', ["%{$value}%"]);
2324
})
2425
->when($modelType, fn (Builder $builder) => $builder->where('model_type', $modelType))
2526
->where('user_id', $request->user()?->getKey())
27+
->latest()
2628
->cursorPaginate()
2729
->withQueryString();
2830
}

0 commit comments

Comments
 (0)