Browse AI Field GuideForum Podcast
All ThreadsLeaderboard
  1. Discussions

    1. Popular This Week
    2. Popular All Time
    3. Solved
    4. Unsolved
    5. No Replies Yet

dan3460's avatar

Livewire Pagination and Search failing

I'm creating a page that show a bunch of commodities this are shown on a livewire component. I have added pagination to it and works fine. Once i added searching it breaks when i start typing on the search box. I suspect that livewire is getting confused with the key after when presenting the new selection, if so how do i create a key that is unique to each element. Or is some

dan3460's avatar
dan3460's avatar Snapey1yr agoLivewire
5
1
Last reply by Snapey 1yr ago
muhammadsaim's avatar

Pagination in Laravel Collection

I have a function which return the array of resource and collection /** * * get the brand * * @param Brand $brand * @return JsonResponse */ public function show(Brand $brand) { $brand = QueryBuilder::for(Brand::class) ->with([ 'products'

muhammadsaim's avatar
muhammadsaim's avatar jlrdw1yr agoLaravel
4
1
Last reply by jlrdw 1yr ago
ignaciodev's avatar

Issue using resources and pagination

I am fetching from my db like this: $shops = ShopifyShop::listable()->cursorPaginate(2); If I return this, everything works well: return ShopifyShopIndexResource::collection($shops); However, I need to append some data to each item in the collection, which I'm trying to do like this: return ShopifyShopIndexResource::collection( $shops->map(fn ($shop) => (new Shop

ignaciodev's avatar
ignaciodev's avatar ignaciodev2yrs agoLaravel
2
1
Last reply by ignaciodev 2yrs ago
ValeraOrolin's avatar

Laravel Nova problem with pagination style

When I use "links" type of pagination, the buttons on the pagination panel become gray. However, pagination of the type "simple" is in color of the brand. This is what html of the button for an unselected page looks like. <button class="border-r border-gray-200 dark:border-gray-700 h-9 min-w-9 px-2 focus:outline-none focus:bg-gray-50 hover:bg-gray-50

ValeraOrolin's avatar
ValeraOrolin's avatar jlrdw2yrs agoNova
1
1
Last reply by jlrdw 2yrs ago
lara32bd's avatar

Gate::authorize() with Livewire pagination

Recently I created a new livewire component replacing my laravel controller, in controller method I use Gate::authorize('user-activity'); which works fine. Same Gate::authorize('user-activity') works fine with the livewire component using pagination. I could easily see the page. However, when I click the next or previous page it shows 'Not authorzied' default page I set for the

lara32bd's avatar
lara32bd's avatar lara32bd2yrs agoLivewire
5
1
Last reply by lara32bd 2yrs ago
jakubjv's avatar

How translate pagination in Laravel 11 ?

Hello I'm struggling with translating text of pagination in Laravle 11. I did publish files of pagination and changed texts but it doesn't work. For example I need to translate sentece Showing 1 to 3 of 7 results but while I change it in published files to another text, it doesn't work and there is no changes. Is here any better approach how to do it ?

jakubjv's avatar
jakubjv's avatar jakubjv2yrs agoLaravel
3
2
Last reply by jakubjv 2yrs ago
myregistration's avatar

Route query string values don't persist with pagination in Filament Resource

I'm using a query string to set a value I need to persist between pagination pages because I use the request() field value with the Resource's getEloquentQuery() method to alter the query results for the Resource. I used dd() for testing and can see the first visit of the Resource page contains the request() field value, but when visit subsequent pagination pages, the value is

myregistration's avatar
myregistration's avatar myregistra...2yrs agoFilament
0
1
huatong's avatar

Livewire Tailwind Table pagination UI bug

So im currenly making a table with livewire and tailwind The first page is not displaying the right ui but when i visit the second page and beyond it shows the correct UI customers livewire <?php namespace App\Livewire; use App\Models\Customer; use Livewire\Component; use Livewire\WithPagination; class Customers extends Component { use WithPagination; public func

huatong's avatar
huatong's avatar Snapey2yrs agoLivewire
2
1
Last reply by Snapey 2yrs ago
mallaury's avatar

Format pagination metadata for all collections (API)

Hello, I'd like to format the pagination of all my Api Resources without having to create a "Collection" class for each Model. I'd like to do it like this: class UserCollection extends ResourceCollection { public function toArray($request) { return [ 'data' => $this->collection->transform(function (User $user) { ret

mallaury's avatar
mallaury's avatar mallaury2yrs agoLaravel
1
1
Last reply by mallaury 2yrs ago
Rafaelindriago's avatar

Livewire 3 pagination don't work after page 2

Hello guys! I'm developing an app with Laravel 11, Livewire 3 and Bootstrap 5, i builded a trait called WithDataTable to create data table components, but the pagination action "nextPage" don't work after the page 2, i tried to use tailwind theme and nothing, using custom view and nothing, calling next page from browser console and nothing, even remove the use of With

Rafaelindriago's avatar
Rafaelindriago's avatar szilagyim1yr agoLivewire
4
1
Last reply by szilagyim 1yr ago
RazIacob's avatar

Having problems with Laravel Scout Typesense pagination

I submited a bug report on the laravel / scout repo about Incorrect Total Count in Laravel Scout Pagination but they closed the issue right away and they told me to ask for help here. This is the issue: laravel/scout/issues/819 Can anyone help with this?

RazIacob's avatar
RazIacob's avatar Dave Wize1yr agoEloquent
3
1
Last reply by Dave Wize 1yr ago
emmatraversy's avatar

Pagination Page Reset By Changing Filters (Is One Character Behind)

Hi everyone I have this Inertia Index Page which is a data table and some filters like search, sort, daterange ... I have a problem with pagination: When user is in page=5 and searches something like "test" because only there is 1 page results available (or no results at all) there is an empty page in page=5$search=test... So I tried to reset the page in query string

emmatraversy's avatar
emmatraversy's avatar gych2yrs agoInertia
11
1
Last reply by gych 2yrs ago
cyberwizard's avatar

Livewire Pagination Button does not work

Hello Guys, here is my code @include('partials.header') <div class="app-content"> <div class="content-wrapper"> <div class="container"> @include('partials.menu-back') <div class="row"> <div class="col card"> <div class="tab

cyberwizard's avatar
cyberwizard's avatar AdamVaclav2yrs agoLivewire
1
1
Last reply by AdamVaclav 2yrs ago
rid3638's avatar

Pagination is not working on laravel 11

I am using laravel 11. This is my code: $scholarships = Scholarship::with([ 'creator', 'fundingTypes', 'providers', 'subjects', 'countries', 'educationLevels', ]) ->latest() ->paginate(10) ->withQueryString(); This is how I show the pagination:

rid3638's avatar
rid3638's avatar rid36382yrs agoLaravel
4
1
Last reply by rid3638 2yrs ago
rudiwer's avatar

Livewire Pagination and Canonical prev / next

I have a list with livewire V3 pagination added, i want to be able to place the correct canonical urls in the header so the current url but also prev and next. i tried to use the $paginator var but it seems the section is not updated when jumping from page to page so the canonicals stays always on the first page? Anyone a idea how to get the section updated?

rudiwer's avatar
rudiwer's avatar rudiwer2yrs agoLivewire
3
1
Last reply by rudiwer 2yrs ago
Farids78's avatar

Search quesry display only results of current pagination

Hi, I have a user table with a search field. If I enter a username on my search field I only get results of the current pagination? How can I get results from the entire table? I guess that this should be managed somewhere in the code below: "use strict"; var KTUsersList = function () { var e, t, n, r, o = document.getElementById("kt_table_users"), c = () =&

Farids78's avatar
Farids78's avatar Snapey2yrs agoJavaScript
4
1
Last reply by Snapey 2yrs ago
jakubjv's avatar

Livewire Pagination The GET method is not supported

Hey everyone, I am struggling with issue about pagination. Problem is, that after i update any table and after updating table i do wanna go to previos page or to next page i am getting error The GET method is not supported for route livewire/update. Supported methods: POST and definetly it doesnt make sense to me. Record are updated in database but, after every updare or delete

jakubjv's avatar
jakubjv's avatar jakubjv2yrs agoLivewire
7
1
Last reply by jakubjv 2yrs ago
NameUnknown's avatar

No pagination data in a JsonResource when returning from a Job

This is unnecessary, but I'm just curious. I created a Job class and removed all Queue traits so it could be dispatched only synchronously. The only traits are: class SyncJob{ use Dispatchable, SerializesModels; Not it can return data from handle() when I dispatch it via dispatchSync: $models = SyncJob::dispatchSync(); The job returns models with pagination wrapped into a Js

NameUnknown's avatar
NameUnknown's avatar NameUnknow...2yrs agoLaravel
3
1
Last reply by NameUnknown 2yrs ago
PetroGromovo's avatar

How to data returned from Repository with pagination apply Resource?

On Laravel 10 site I use Repository working with db and in controller I need to return data with Resource /app/Http/Controllers/Api/ItemController.php : <?php class ItemController extends Controller { public function index() { $request = request(); $data = $itemRepository->index( page: $request->page ?? 1, filters: $reque

PetroGromovo's avatar
PetroGromovo's avatar shariff2yrs agoLaravel
1
1
Last reply by shariff 2yrs ago
Nihir's avatar

How to use pagination in laravel Breez - Vue ?

hi folks I created the Laravel Breeze application with the vue (Not alter vue install with the breeze option) So the question is if I want to use the pagination in code how can I use it? Here is the Controller code... public function index() { $categories = Category::orderBy('id', 'DESC')->paginate(10); return Inertia::render('Admin/Category/Index', compa

Nihir's avatar
Nihir's avatar DhPandya2yrs agoVue
1
3
Last reply by DhPandya 2yrs ago
Luckyfox's avatar

Pagination breaks after any interaction

When I load the page pagination works fine, but after any interaction, as in filtering, the pagination changes from luckyfox.test/jobs-page?page=2 to luckyfox.co.uk/livewire/update?page=2 I've removed some code that shouldn't effect this to keep the post smaller. Livewire: namespace App\Http\Livewire; use App\Models\JobApplication; use Carbon\Carbon; use Livewire\Attributes\L

Luckyfox's avatar
Luckyfox's avatar Luckyfox2yrs agoLivewire
0
1
vinay8vee's avatar

Can we cache query run on pagination to count the results?

Can we cache query run on pagination to count the results. How can we do that? any plugins? I don't want any query builder approach as it could impact all the models or queries in my existing system.

vinay8vee's avatar
vinay8vee's avatar vinay8vee2yrs agoEloquent
6
1
Last reply by vinay8vee 2yrs ago
hjortur17's avatar

Trying to make custom pagination

Hi, I have been trying to create custom pagination for my data because I'm merging three arrays. But, I'm struggling with mapping my merged data to the same structure as Laravel would do if I would use ->paginate(x) on the model. Is there a way in Laravel to use the predefined Pagination resource or is there a way to make it look similar? I have almost achieve this but I thi

hjortur17's avatar
hjortur17's avatar vincent150...2yrs agoLaravel
2
1
Last reply by vincent15000 2yrs ago
mani273's avatar

In livewire how to dispatch an event during a page change (pagination)

I have a animation which triggers on page load. I want to trigger the animation when I switch to another page through pagination link. Problem is even though I can fire the event and run the function, the function only adds the animation to my previous page content. As a result I don't get to see the animation when I switch pages Dispatch event on page change public function up

mani273's avatar
mani273's avatar mani2732yrs agoLivewire
1
2
Last reply by mani273 2yrs ago
rudolfbruder's avatar

Laravel pagination and Axios await changing response data

Hi, I am struggling with really strange behaviour. I have simple API which returns classic laravel pagination data with links last page etc. Problem is when I call this axios call in vuex action like this: async fetchElasticColoredProducts({ commit, rootGetters, getters }) { const response = await axios.get(url); commit("SET_COLORED_PRODUCTS", response.data.colored_

rudolfbruder's avatar
rudolfbruder's avatar rudolfbrud...2yrs agoVue
2
1
Last reply by rudolfbruder 2yrs ago
AlexSteele's avatar

Livewire 3 Pagination and DB Facade question

I was trying to get pretty sophisticated with a livewire component that allowed inline editing and pagination. I kept running into this issue of needing to declare a property for, let's say, services as an example. so I struggled with that a while, until someone helped me in an earlier question. Thanks, @snapey... I concluded that inline editing is neat, but the design pat

AlexSteele's avatar
AlexSteele's avatar jlrdw2yrs agoLivewire
2
1
Last reply by jlrdw 2yrs ago
AlexSteele's avatar

Livewire3 pagination questions

I have a question about livewire pagination. in a fairly traditional livewire component, I had this : use Livewire\Component; use Illuminate\Contracts\View\View; use Livewire\WithPagination; use App\Models\Service; class Services extends Component { use WithPagination; public $services; which results as: foreach() argument must be of type array|object, null given fro

AlexSteele's avatar
AlexSteele's avatar AlexSteele2yrs agoLivewire
3
1
Last reply by AlexSteele 2yrs ago
IgnacioB's avatar

set perPage in livewire Pagination

blade.php <div> <label for="perPage">Resultados por página:</label> <select id="perPage" wire:model="perPage"> <option value="10">10</option> <option value="20">20</option> <option value="50">50</option> </select> <

IgnacioB's avatar
IgnacioB's avatar IgnacioB2yrs agoLivewire
5
1
Last reply by IgnacioB 2yrs ago
d3lus10n's avatar

Filter records with infinite pagination in Inertia

Hewo, I just completed the Infinite Pagination course with Inertia and Vue from Laracast and it does not contemplate the implementation of filters, I have done them as usual through request and a scope that filters the query on the back-end, but I am very confused how to make it work on the front-end, the files are as follows: // Index.vue <script setup> import { ref, wa

d3lus10n's avatar
d3lus10n's avatar d3lus10n2yrs agoInertia
2
1
Last reply by d3lus10n 2yrs ago
RayC's avatar

Livewire pagination adding form fields to query string

Hello, I have a livewire page with some filters at the top of the page long with an 'Apply Filters' button. These all work as expected with no issues. I am also including the query string so users can bookmark filtered results for later use, this work sa expected. Issue is with the pagination, If I for instance change the date, select something, add any text to the search filed

RayC's avatar
RayC's avatar LaryAI2yrs agoLivewire
1
1
Last reply by LaryAI 2yrs ago
Snapey's avatar

Beware pagination with offset

I ran into an issue this morning, which I cannot see anything online about it (maybe I have not found the right search terms yet) so posting here incase it helps someone in the future. Imagine you have a mysql database with 30 or so events. The events each have a date field. The paginated eloquent query might look like; $events = Event::where('course_id',$course->id)->o

Snapey's avatar
Snapey's avatar jlrdw2yrs agoEloquent
6
1
Last reply by jlrdw 2yrs ago
Bervetuna's avatar

Livewire pagination issues in combination with cart

In this project I use Livewire and installed a shopping cart package (bumbummen99/shoppingcart). In the view, I'm looping through the products. I use WithPagination (10 results per page). On every row there is a button to add the product to the cart. @foreach ($artikels as $artikel) <tr>

Bervetuna's avatar
Bervetuna's avatar Bervetuna2yrs agoLivewire
0
1
phayes0289's avatar

Weird Pagination Malfunction

All of my paginations in my project are suddenly not working. I don't know when it started, but I just noticed it today. I know at one time they were working. They do fully display, but none of the links work. What could be causing that? UPDATE 10/29/2023; Bootstrap issue? I have figured out what the cause issue is, but have no idea how to resolve it. My site relies on Boots

phayes0289's avatar
phayes0289's avatar Snapey2yrs agoLaravel
10
1
Last reply by Snapey 2yrs ago
MomoDerDodo's avatar

Livewire 3 Upgrade breaks Pagination in a weird way

Hello Everyone, i tried upgrading my Livewire version from 2 to 3 but when i do, the pagination breaks in a weird way and is not properly functioning anymore. When clicking the controls of the paginator, for example "next" only the first item gets changed and the others stay as before. If i change the URL Parameter by hand, everything works fine. I tried upgrading the

MomoDerDodo's avatar
MomoDerDodo's avatar 0e0m0a0n01yr agoLivewire
2
1
Last reply by 0e0m0a0n0 1yr ago
ritechoice23's avatar

Pagination meta not showing

I face a challenge with an API I am developing, when I return paginated data directly without an API resource all pagination meta will be returned but anytime I add the API resource, the pagination meta will not be present.

ritechoice23's avatar
ritechoice23's avatar vincent150...2yrs agoRequests
1
1
Last reply by vincent15000 2yrs ago
YasseMoh's avatar

problem with pagination

I have a form which sends data to controller using GET method: this is the route: Route::get('search',[MainController::class,'search'])->name('search'); The search function in the MainController receives data sent through the form and returns a variable ($result) like this: return view('search',compact('result')); in the view: @foreach ($result as $value) {{$value->title

YasseMoh's avatar
YasseMoh's avatar YasseMoh2yrs agoLaravel
4
1
Last reply by YasseMoh 2yrs ago
hcastillo's avatar

How preservate parameters in pagination Laravel 10 + Inertia + vue 3

Hi, i having problem to preserve parameters from my pagination. i have 3 filters (isActive, isAuthorized, search) when u set any o them a watch from vue make a call to get the filtered data and everything is ok but went y try to search in next page all my parameters gone. in the pagination component i dont get the filters because i want to use current parameters from uri but ca

hcastillo's avatar
hcastillo's avatar ThiagoDOM2yrs agoInertia
2
1
Last reply by ThiagoDOM 2yrs ago
francuel's avatar

Pagination system without URL parameters

Hello, When using the pagination system that Laravel itself offers, page links look like this: http://127.0.0.1:8000/blog http://127.0.0.1:8000/blog?page=2 http://127.0.0.1:8000/blog?page=3 But I wanted a more friendly URL, that is: http://127.0.0.1:8000/blog http://127.0.0.1:8000/blog/page/2 http://127.0.0.1:8000/blog/page/3 Is there any way to do this without giving up the

francuel's avatar
francuel's avatar jlrdw2yrs agoLaravel
7
1
Last reply by jlrdw 2yrs ago
Q8Xbox's avatar

Infinite Scroll Pagination to Laravel 9

I have a galley page and since it has too many images. I would like to implement infinite scroll pagination so I have a look at jQuery plugin named jScroll in this link: https://devdojo.com/bobbyiliev/how-to-add-a-simple-infinite-scroll-pagination-to-laravel It look likes the code is old since pagination navigation use Nav tag instead of ul.pagination so how I can make this wo

Q8Xbox's avatar
Q8Xbox's avatar Q8Xbox2yrs agoLaravel
4
1
Last reply by Q8Xbox 2yrs ago
vrerabek's avatar

Laravel data computation, sorting, and pagination: How to make it reusable and effortless?

Hello everyone, I'm currently working on my first relatively complex Laravel application and could use some guidance. I need to display data on the frontend that involves both computed values and the ability to sort based on user input, all while maintaining pagination. For instance, I've created an accessor in my Player model as shown below: public function getRewardReceiv

vrerabek's avatar
vrerabek's avatar Snapey2yrs agoLaravel
2
1
Last reply by Snapey 2yrs ago
Arasma's avatar

Customizing The Pagination Information doesn't work for Resource::collection()

Hello, I am trying to customize pagination information for a resource collection. According to the 10.x docs If you would like to customize the information included in the links or meta keys of the pagination response, you may define a paginationInformation method on the resource I am returning my resource collection like so return CampaignIndexResource::collection($results-&

Arasma's avatar
Arasma's avatar Merklin1yr agoLaravel
5
1
Last reply by Merklin 1yr ago
VETO87's avatar

Pagination Links Not Displaying Correctly When Using Livewire Component

I'm facing an issue with pagination links not displaying correctly when I include a Livewire component within a loop to display orders. The pagination appear with pages numbers but it's not wokring this is my code <div class="accordion"> @foreach ($orders as $order) <div id="ID_{{ $order->id }}"> <livewire:

VETO87's avatar
VETO87's avatar vincent150...2yrs agoLivewire
3
1
Last reply by vincent15000 2yrs ago
ehask71's avatar

Pagination ... 63 seconds to return

I have a couple large tables 900k accounts and 1 million plus orders ....... I am trying to figure out a way to paginate this data to make it useable for customer service. My Accounts table takes over 1 minute to render the page of paginated data. The orders times out. I am using the fastPaginate() package that helped. I am currently doing this $accounts = Account::on('

ehask71's avatar
ehask71's avatar Snapey2yrs agoLaravel
5
1
Last reply by Snapey 2yrs ago
Ligonsker's avatar

Server fetched partials + pagination - how to remove the partial route?

Hello, I am calling a table with pagination using server-fetched partial. The table is at www.example.com/mypage. I also have a route that fetched the partial via the fetch() API on mypage-partial, which returns the table with the pagination links and inserts them inside the #table-container div: // mypage-partial.blade.php <table> // display the data </table> {{ $

Ligonsker's avatar
Ligonsker's avatar Ligonsker2yrs agoCode Review
2
1
Last reply by Ligonsker 2yrs ago
vviglaf's avatar

Eloquent Pagination While Eager Loading

I was just re-watching the eloquent performance patterns series from Laracast. In this lesson; we are just eager loading and using setRelation to get Feature Feature's comments comment's user reducing the query count and model responses on usage of this command @if ($comment->isAuthor()) via: $feature->load('comments.user'); $feature->comments->each->se

vviglaf's avatar
vviglaf's avatar vviglaf2yrs agoEloquent
0
1
Ligonsker's avatar

Real time search + pagination

Hello, I currently use Laravel's pagination and whenever I need a search feature I simply add a search box that, when submitted, saves the value in a session key in the backend and then it refreshes the page with the filtered query. Now I want to change it to be real time search so that the page won't refresh. In this case, should I completely stop using the Laravel pagination

Ligonsker's avatar
Ligonsker's avatar vincent150...2yrs agoCode Review
7
1
Last reply by vincent15000 2yrs ago
voiceinthedark's avatar

Capturing the Pagination links in AlpineJs

I have a searchbar component which available on many pages, when user input a string, I populate the result and dispatch it as a browser event, then capture it in my view. My problem is that I want to paginate the result by providing a next and previous pages buttons on the search dropdown; How can I capture the pagination links in Alpinejs? Here is my code: // searchbar.php co

voiceinthedark's avatar
voiceinthedark's avatar voiceinthe...2yrs agoLivewire
2
1
Last reply by voiceinthedark 2yrs ago
DanRalphs's avatar

Scout pagination does not return new results

Hi, I may be missing something here, but I am hoping someone can shed some light onto this. I am using laravel scout to search my index which is Opensearch on AWS and I am using the scout pagination method and while it returns results in sets of 5. I am using the ->paginateRaw(5) method. However it seems to only be returning the same 5 results every time? Does anyone have an

DanRalphs's avatar
DanRalphs's avatar DanRalphs2yrs agoLaravel
1
1
pshitote's avatar

How do I modify pagination link to page 1 using custom length aware paginator?

I have an index page with {{ $posts->links() }} by default that renders navigation page links in my view template. My controller looks like this: public function index(){ return view('postcards.index', [ 'postcards' => Postcard::paginate(20) ]); } What this does is that it renders navigation links in my view template such that when I click on 1, my url changes to http://l

pshitote's avatar
pshitote's avatar Snapey2yrs agoLaravel
1
1
Last reply by Snapey 2yrs ago
deekepMaks's avatar

cursor pagination order by

I am using mongodb and using cursor pagination. I am trying to use orders to sort the data I am getting. When I sort by _id I get correct data without any problem. When I start sorting, for example, by the created_at field, then I get the first page correct, and then emptiness, and there is no link to the previous page. My code: $sort = $request->get('sort'); $data = User::o

deekepMaks's avatar
deekepMaks's avatar s4muel2yrs agoLaravel
1
57
Last reply by s4muel 2yrs ago

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.

Want us to email you occasionally with Laracasts news?

Nine out of ten doctors recommend Laracasts over competing brands. Come inside, see for yourself, and massively level up your development skills in the process.

Learn
BrowseSeriesCreatorSeriesLaravel PathLarabitsPlayground
Discuss
ForumPodcastSupport
Extras
Gift CertificatesApparelFAQiOS AppTerms
Social
X(Twitter)TikTokYoutube

© Laracasts 2026. All rights reserved. Yes, all of them. That means you, Todd.

Proudly hosted with Laravel Forge and DigitalOcean.