Skip to content

Commit

Permalink
Fix pagination on photos page
Browse files Browse the repository at this point in the history
  • Loading branch information
GeniJaho committed Mar 10, 2024
1 parent b9a7129 commit 0a31b94
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/Actions/Photos/FilterPhotosAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ public function run(User $user, int $perPage): LengthAwarePaginator
->filter($user->settings->photo_filters)
->withExists('items')
->latest('id')
->paginate($perPage);
->paginate($perPage)
->withQueryString();

$photos->getCollection()->transform(function (Photo $photo) {
$photo->append('full_path');
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/PhotosController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function index(
$user->save();
}

$perPage = in_array($request->integer('per_page'), [12, 24, 48, 96])
$perPage = in_array($request->integer('per_page'), [12, 24, 48, 96, 192])
? $request->integer('per_page')
: 12;

Expand Down
3 changes: 2 additions & 1 deletion resources/js/Pages/Photos/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const perPageOptions = [
{label: '24 per page', value: 24},
{label: '48 per page', value: 48},
{label: '96 per page', value: 96},
{label: '192 per page', value: 192},
];
const perPage = ref(perPageOptions.find(option => option.value === props.photos.per_page));
Expand Down Expand Up @@ -113,7 +114,7 @@ const filter = (filters) => {
</h2>
</template>

<div class="py-6 lg:py-12">
<div class="py-6 lg:py-16">
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">

<div class="flex flex-row gap-4 px-4 sm:px-0">
Expand Down

0 comments on commit 0a31b94

Please sign in to comment.