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

MirkoKlefker's avatar

Pagination css defect

Hi, I updated my Laravel from version 7 to the latest version 10. I noticed that the pagination is now corrupted. Original with Laravel 7: Nowwith Laravel 10: Also the Navigation changed from UL to DIV How can I Fix it? Laravel 7: <nav> <ul class="pagination"> <li class="page-item disabled" ar

MirkoKlefker's avatar
MirkoKlefker's avatar tykus2yrs agoDesign
3
2
Last reply by tykus 2yrs ago
babai9's avatar

How to create pagination in eager loaded relationship in laravel

I want the pagination to happen in eager loaded relation but when I am using it I am getting an error. Method Illuminate\Database\Eloquent\Collection::links does not exist. This only happens when I use {{ $SubjectReport->reports->links() }} in views rather than that everything is working fine as when I remove this {{ $SubjectReport->reports->links() }} the page load

babai9's avatar
babai9's avatar babai93yrs agoLaravel
2
1
Last reply by babai9 3yrs ago
vampiremr's avatar

Nova 4 pagination

Hi Is anybody have full manual how to change template for default pagination in Nova? Many links in Google, but nothing helping Issue - I need to move "per page select" to the bottom near pagination

vampiremr's avatar
vampiremr's avatar vampiremr3yrs agoNova
2
1
Last reply by vampiremr 3yrs ago
themenace's avatar

Pagination -> goto page that has today's date

Imagine a list of flights, dates in the past and into the future, so many that pagination is required. Let's say we're 6 months of past flights and 6 months of future flights (for example) I can query all flights and orderby date desc and display that on an index blade with pagination. The user would then have to use the reference links to go back some number to get to a list o

themenace's avatar
themenace's avatar themenace3yrs agoEloquent
4
1
Last reply by themenace 3yrs ago
tome-sbk's avatar

Bootstrap pagination in Angular.js

Hi, I'm using laravel 5.2 and my response from endpoint is look like this: { "vehicles": { "total": 173, "per_page": 20, "current_page": 1, "last_page": 9, "next_page_url": "http://localhost/api/vehicles?page=2", "prev_page_url": null, "from": 1, "to&

tome-sbk's avatar
tome-sbk's avatar LaryAI3yrs agoJavaScript
1
1
Last reply by LaryAI 3yrs ago
moritz99's avatar

Database dashboard with auto refresh and pagination

Hi, I have a project with several database tables and want to create a dashboard showing 4 tables with individual pagination. This dashboard should refresh every 10 seconds automatically without any user interaction and should also increase every page number on those tables. So far I have achieved both pagination and auto refresh with jumping to the next page. The only problem

moritz99's avatar
moritz99's avatar newbie3603yrs agoLivewire
5
1
Last reply by newbie360 3yrs ago
moritz99's avatar

Database dashboard with auto refresh and pagination

Hi, I have a project with several tables and want to create a dashboard showing 4 data tables with individual pagination. This dashboard should refresh every 10 seconds automatically without any user interaction and should also increase every page number on those tables. What do you think, would be the best way to implement that functionality?  How to implement auto refresh?  H

moritz99's avatar
moritz99's avatar vincent150...3yrs agoLaravel
1
1
Last reply by vincent15000 3yrs ago
jaeyson's avatar

Pagination total items is 1000 even though record count is 2000

Hi, I'm using seeder to create 2000 records and using livewire pagination. pk is integer, starting at 1 and ends at 2000 and it is using Meilisearch. E.g. I have a model (Catalog): Catalog::paginate(10)->total() // a total of 2,000 records 2000 Catalog::search('')->paginate(10)->total() // 1000 idk why Catalog::paginate(10)->lastPage() // 200 pages 200 If I have

jaeyson's avatar
jaeyson's avatar jaeyson3yrs agoEloquent
9
1
Last reply by jaeyson 3yrs ago
Randy_91's avatar

Pagination in Nova 4 custom tool

How do I get pagination working in the following Tool.vue file <template> <LoadingView :loading="initialLoading"> <Heading :level="1" class="mb-3 flex items-center"> <span>Adverts</span> </Heading> <div class="flex mb-6"> <IndexSearchInput

Randy_91's avatar
Randy_91's avatar KaiHiwatar...2yrs agoNova
9
2
Last reply by KaiHiwatari 2yrs ago
learner2023's avatar

customize laravel pagination

i have 1000's products so i used the paginate(),so what i want is that i don't need the users to know the total products count i want to customize by showing only 8 pagination pages, when we click on next button we should get next 8 pagination page links like that so on i.e, the context is that i should restrict the users to know the total products count is that possible ?

learner2023's avatar
learner2023's avatar PovilasKor...3yrs agoLaravel
4
1
Last reply by PovilasKorop 3yrs ago
Watheq's avatar

How to make laravel pagination pretty instead of query params?

I want to change pagination default from ?page=2 to /page/2 I have tried https://github.com/spatie/laravel-paginateroute but it is archived & used for old Laravel verisons. How can I implement this?

Watheq's avatar
Watheq's avatar Watheq3yrs agoLaravel
6
1
Last reply by Watheq 3yrs ago
chahal's avatar

Pagination with Laravel API Resource

Hi guys, I need to send pagination data in response Here is my controller public function list(Request $request) { $jobs = $request->user()->jobs()->paginate(2); $jobs = $jobs->map(fn($job) => new JobResource($job)); return response([ 'message' => 'Employer jobs', 'data' => $jobs ]); }

chahal's avatar
chahal's avatar jaseofspad...3yrs agoLaravel
1
1
Last reply by jaseofspades88 3yrs ago
Ligonsker's avatar

How to persist button selections when changing pages with pagination (But not on refresh)

Hello, I have a table with pagination and a column that has 2 buttons you can toggle between for each row. The buttons are pre-selected according to data from the database: @foreach($rows as $row) <tr> <td> ... </td> <td> ... </td> <td> <div class="buttons"> <button {{

Ligonsker's avatar
Ligonsker's avatar Ligonsker3yrs agoCode Review
7
1
Last reply by Ligonsker 3yrs ago
bnewton's avatar

Blade Fragments is not working with Pagination.

I have been working with Blade Fragments and running into the issue of correctly having the Laravel Pagination update within Blade Fragments. @fragment('user-pagination') {{ $users->links() }} @endfragment Is there any known issue that keeps Pagination from being updated within Blade Fragments?

bnewton's avatar
bnewton's avatar jlrdw3yrs agoLaravel
1
1
Last reply by jlrdw 3yrs ago
ekm1995's avatar

navigate with href="#id" when click on pagination livewire

Hi guys. I create a comment section with livewire and pagination for it. My problem is when the user clicks on page 2, he must scroll up to get the next page information. Is there any way to go to the top of paginated list?

ekm1995's avatar
ekm1995's avatar ekm19953yrs agoLivewire
0
1
CamKem's avatar

Changing pagination data struction

How can I change the way paginate works? I want to do what Laracasts does & wrap all the meta items in a meta object, like this: Conversations |----data |----links |----meta (first page, last page, current page, etc..) Rather than the standard way the pagination data is returned which is like this: Conversations | |---- Data (array)

CamKem's avatar
CamKem's avatar CamKem3yrs agoEloquent
2
2
Last reply by CamKem 3yrs ago
Emokores's avatar

Page rerendering during pagination - Inertia/ReactJS

I have a table that displays a list from the database. It uses live search to filter data from the backend. However, when I try to use the pagination (Laravel pagination) the component instead rerenders back to page 1 whenever I go to page 2 or some other page. // This is the code in the controller $search = $request->query('q'); 'clients' => Client::query()->when($se

Emokores's avatar
Emokores's avatar LaryAI3yrs agoInertia
1
1
Last reply by LaryAI 3yrs ago
ella-stinnes's avatar

Display Pagination Totals on Single Page of Results

I'm displaying the pagination links as follows in my blade file: {{ $data->links() }} This is displaying the pagination links and provides an overview on the total number of records: Showing 1 to 10 of 18 results I have an issue that when I run a search and the total number of records can fit to a single page, both the pagination links and totals disappear. I understand wh

ella-stinnes's avatar
ella-stinnes's avatar ella-stinn...3yrs agoLaravel
4
1
Last reply by ella-stinnes 3yrs ago
mrkarma4ya's avatar

How to create pagination but with a max limit?

Let's say I have a table with 100,000 rows. I want only the first 1000 rows, but I also want to paginate them by 25 as well. Is there any way to do it? I saw this post: https://laracasts.com/discuss/channels/laravel/how-to-limit-in-pagination-in-laravel The answer there was to paginate the collection, but is it possible to instead do a normal pagination over database instead?

mrkarma4ya's avatar
mrkarma4ya's avatar JussiManni...3yrs agoEloquent
3
9
Last reply by JussiMannisto 3yrs ago
dr24's avatar

Pagination and query too slow on server

I have get all users method that shows all users from database with pagination. On local everything works fine and fast but thats probably because I don't have many users in database. But when I go to server it takes one minute to open up get all users page and when I scroll down it takes same amount of time to opet ?page=2 and etc. Query calculates distance from other users b

dr24's avatar
dr24's avatar dr243yrs agoLaravel
2
1
Last reply by dr24 3yrs ago
shahabes's avatar

Multiple Array pagination

Hello, I have four arrays in my controller that should be paginated in the view. So, I'm using the following method to paginate arrays. public function paginate($items, $perPage = 5, $page = null, $options = []) { $page = $page ?: (Paginator::resolveCurrentPage() ?: 1); $items = $items instanceof Collection ? $items : Collection::make($items);

shahabes's avatar
shahabes's avatar LaryAI3yrs agoLaravel
1
1
Last reply by LaryAI 3yrs ago
DavidMathews's avatar

OrderByRaw with Pagination

Does anyone have an example of a working orderByRaw working with Pagination? The first page is ordered correctly but any page clicked in the pagination returns the collection without the orderByRaw applied....

DavidMathews's avatar
DavidMathews's avatar LaryAI3yrs agoLaravel
1
1
Last reply by LaryAI 3yrs ago
CamKem's avatar

Help with pagination in Laravel / Vue with collection mapping

Hello, I am trying to work out pagination in Vue. On the server side I have the following code to create a 'users' object that both paginates & maps over the object. Route::get('/users', function () { sleep(1); $users = User::paginate(15); $mapped = $users->map(function ($user) { return [ 'id' => $user->id, 'name' => $

CamKem's avatar
CamKem's avatar LaryAI3yrs agoVue
1
1
Last reply by LaryAI 3yrs ago
Gabotronix's avatar

Vue: problem with laravel and vue pagination

I'm trying to get laravel pagination to work but for some reason I can only fetch first page results, even when I press page 2 when I check the request payload it's always on page one... also when I click on page two button it gets highlighted correctly but then goes back to first button active... My pagination component: <template> <nav class="LAYOUTpagination1_m

Gabotronix's avatar
Gabotronix's avatar LaryAI3yrs agoJavaScript
1
1
Last reply by LaryAI 3yrs ago
t0berius's avatar

laravel load() with pagination

Is there a way to use load() with a pagination? Code: case 'deposits': $user->load(['deposits' => function ($query) use ($request) { $query->latest(); }])->paginate(15)->appends($request->input()); break; return view('userProfile',[ 'user' => $user, ]); I've already tried both, inc

t0berius's avatar
t0berius's avatar Sinnbeck3yrs agoEloquent
6
1
Last reply by Sinnbeck 3yrs ago
sididev's avatar

How can I implement this responsive style on my pagination?

I use tailwind css for my pagination, I have a little problem with a style. This image is my default paging style here, that's fine. My problem is here: it's my responsive image and it's not what I want. I also need to make it flexible inline like the first image on mobile. My code: <div class="mt-5 flex flex-wrap items-center justify-center gap-x-1 text-xs font-sem

sididev's avatar
sididev's avatar d3v3yrs agoDesign
6
1
Last reply by d3v 3yrs ago
MazenUit's avatar

Problem not showing Pagination if you query data based on status in nested component

I have set of data in same table that displayed on blade in different component based on status 0 or 1 but listing of this data for each component is missing how to query pagination in this case ?

MazenUit's avatar
MazenUit's avatar Sinnbeck3yrs agoLaravel
1
1
Last reply by Sinnbeck 3yrs ago
Ligonsker's avatar

How to get list of ids from pagination query of the current page?

Hello, I have 1 pagination query for every: $pagination_query = Table1::...->paginate(100); then I have a second query that needs to use the list of ids from the pagination query: $second_query = Table2::whereIn('id', $list_of_ids_from_pagination_query); How can I get the list of ids only from the paginated page so that I get 100 ids and not thousands of ids which will end

Ligonsker's avatar
Ligonsker's avatar Sinnbeck3yrs agoCode Review
3
2
Last reply by Sinnbeck 3yrs ago
arashb's avatar

change pagination style

i have published the pagination portion via "php artisan vendor:publish --tag=laravel-pagination" and modified some classes. then i run "npm run dev" but the modifications are not reflected. what is the problem? is there some other way of doing this? p.s. i don't know if it's related or not but the paginateion is a livewire component

arashb's avatar
arashb's avatar arashb3yrs agoLaravel
2
1
Last reply by arashb 3yrs ago
umairparacha's avatar

What to use for pagination having rows more then 15 million with Mysql

Hi everyone, I have 15 million records in the results table, and we need to order by backlog_day descending, and its value will be the difference between the current date and evaluation_due_date. I tried to use cursor pagination, but cursor pagination requires a unique column for pagination, and the backlog_days can have the same values. Pagination with offset is not performant

umairparacha's avatar
umairparacha's avatar Tray23yrs agoGeneral
3
1
Last reply by Tray2 3yrs ago
sreeharshrajan's avatar

Multiple Pagination Instance Support Fix for Custom Pagination Method

Hello Laravel Developers, I have been using the following Pagination Helper to modify the built-in pagination method, but unfortunately this doesn't seem to work with Multiple Pagination Instance in a Single Page (2 paginations in 1 page). public static function paginate($items, $perPage = 15, $path = '') { $options = [ 'path' => $path ];

sreeharshrajan's avatar
sreeharshrajan's avatar Sinnbeck3yrs agoLaravel
7
1
Last reply by Sinnbeck 3yrs ago
azbx's avatar

Inertia Pagination tips

I'm wondering if I can have the pagination previous and the next separate in vuejs.

azbx's avatar
azbx's avatar [aeo]3yrs agoVue
12
1
Last reply by [aeo] 3yrs ago
Yorkata's avatar

Pagination + Search problem

My pagination is not working when I try to search for something. When I try to search test the URL is like that: /search?query=test When I change the page with pagination link the URL is like that: /search?page=2 and the table with results is empty Route: Route::get("/search", [CompetitionController::class, 'index'])->name('search_bar_route'); Function in Controll

Yorkata's avatar
Yorkata's avatar Sinnbeck3yrs agoLaravel
3
1
Last reply by Sinnbeck 3yrs ago
devianvisuals's avatar

Pagination onEachSide Method not working

Could someone explain to me how to use the database pagination onEachSide method? Controller: $paginate = DBTable::paginate(2); // DBTable has 20 rows return view( 'adjusting-the-pagination-link-window', ['paginate' => $paginate] ); View: {{ $paginate->onEachSide(2)->links() }} // Pagination Output: < 1 2 3 4 5 6 7 8 9 10 > Variable Contents: Illuminate

devianvisuals's avatar
devianvisuals's avatar devianvisu...3yrs agoLaravel
2
1
Last reply by devianvisuals 3yrs ago
Rediska's avatar

How to get all data if pagination is used?

I can't seem to get the job done when I use pagination. This is how I receive products: $products = Product::getProducts($categories, $attributes, $sortName, $sortOrder); This is what I put in the model: public static function getProductsWithAttributes ($categories, $attributes, $sortName, $sortOrder) { return static::select() ->whereIn('category_title'

Rediska's avatar
Rediska's avatar vincent150...3yrs agoEloquent
7
1
Last reply by vincent15000 3yrs ago
ImWaller's avatar

Turn pagination into json

Hello everyone, I try to create a custom infinity loading pagination with splade and vue. I try to use Model::paginate and return the eloquent but I want to return as json. Any help?

ImWaller's avatar
ImWaller's avatar Sinnbeck3yrs agoLaravel
4
1
Last reply by Sinnbeck 3yrs ago
Yorkata's avatar

Pagination stacks up pages in the URL

I've got a problem with pagination and one way to fix it is to use appends(request()->query()) $competitions = Competition::orderBy('id', 'DESC')->paginate(2)->appends(request()->query()); But the problem now is that it makes the URL really weird. When you go back and forth it stack up the pages like this http://local:8003/competitions?%2F%2Fcompetitions%3F%2F%2Fcom

Yorkata's avatar
Yorkata's avatar Yorkata3yrs agoLaravel
2
1
Last reply by Yorkata 3yrs ago
laravel_ninja's avatar

Client Side Pagination Using Javascript

Hi, I want to add pagination into my table using simple javascript /jquery. But the problem here is that I'm creating table from excel file on the click of a button means when first time DOM is rendered table is not their at all . Below is the code of converting excel file to table processButton.addEventListener("click", function () { console.log("Process but

laravel_ninja's avatar
laravel_ninja's avatar Tray23yrs agoJavaScript
6
1
Last reply by Tray2 3yrs ago
Princechrisvic's avatar

Laravel Api pagination links() not working

I fetch a record from that has pagination my website A through API and want to display the result on my website B. The issue here is that it the {{$result->links()}} is not working. It keeps throwing an error "Method Illuminate\Support\Collection::links does not exist.". So how then can we display Laravel API pagination in blade view?

Princechrisvic's avatar
Princechrisvic's avatar Sinnbeck3yrs agoLaravel
3
1
Last reply by Sinnbeck 3yrs ago
Yorkata's avatar

Pagination not working

Hello! I wanted to add pagination to my project and followed a tutorial for that. When I click new page the results are not changing. In my Controller I added this $competitions = Competition::latest()->paginate(1); Then into app/Providers/AppServiceProvider added this use Illuminate\Pagination\Paginator; and inside the boot function added this: Paginator::useBootstrap(); A

Yorkata's avatar
Yorkata's avatar Yorkata3yrs agoLaravel
15
1
Last reply by Yorkata 3yrs ago
vincent15000's avatar

append() and meta pagination data with API Resources

Hello, When I add append() to load appended properties, I lose any meta pagination datas. public function with($request) { return [ 'meta' => [ 'can_create' => auth()->user()->can('create', Course::class), ], ]; } ... new CourseCollection(Course::with('topic.unit', 'room')->where('training_id', $training->id)->orderByDesc

vincent15000's avatar
vincent15000's avatar vincent150...3yrs agoEloquent
1
1
Last reply by vincent15000 3yrs ago
motinska94's avatar

Does using limit() before pagination to optimize withSum method make sense?

I'm using ->withSum(['column1', 'column2']) method to get sum of selected columns from multiple rows in the table. I was wondering if I can use ->limit($paginate_count) before withSum() and paginate() methods to optimize the speed a little. Does this make sense? I added it to my command and nothing much changed, or at least it didnt break 😅 I just wanted to ask if this ma

motinska94's avatar
motinska94's avatar Sinnbeck3yrs agoCode Review
3
1
Last reply by Sinnbeck 3yrs ago
galaners's avatar

Remove Pagination Page Value When Using Filters

I've a basic CRUD where you can search by some typing value or selecting some category. The issue here is that after selecting some page (I use pagination for the records) and then select a category, the page value remains while the filter is on, so, if the number of records of the category is much fewer than without it, the page will cause that the manager can't see any record

galaners's avatar
galaners's avatar galaners3yrs agoLaravel
3
1
Last reply by galaners 3yrs ago
uiop's avatar

let me explain, how to set pagination

the data from external API using cURL get request with domain and fields.how to set pagination with offset. public function search_with_date_range($date_from,$date_to) { $customer = Customer::find(Auth::id()); $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => $this->api_url.'/apilink/', CURLOPT_RETURNTR

uiop's avatar
uiop's avatar uiop3yrs agoLaravel
0
1
Maison012's avatar

It is okay to use POST method for pagination?

I have builded a table who manage some data passed from laravel. But i have too many data and of course i use pagination, also i have added a view per page. Every thing works but i dont feel very good with this method. I mean i use post method to pass view per page value with ajax couse my front end is vue js. //laravel controller public function getUsers(Request $request)

Maison012's avatar
Maison012's avatar Sinnbeck3yrs agoLaravel
19
1
Last reply by Sinnbeck 3yrs ago
laravel_ninja's avatar

Laravel Ajax pagination not working

I'm trying to use Ajax pagination in Laravel using object partials but that's not working as I'm expecting . On first click it's loading data without page reload on second click it's loading data with page reload . I don't know why . May I get help from anyone . Here is my index blade code <!DOCTYPE html> <html lang="en" class="scroll-smooth"> &

laravel_ninja's avatar
laravel_ninja's avatar vincent150...3yrs agoLaravel
1
1
Last reply by vincent15000 3yrs ago
laravel_ninja's avatar

Laravel Ajax Pagination with Tailwind Css

Hi I want to implement pagination using Ajax and Tailwind Css. But I can't find any right solution for that . Can anyone please help me to implement that or share any article that help me to implement .Thanks in advance......

laravel_ninja's avatar
laravel_ninja's avatar Sinnbeck3yrs agoLaravel
2
1
Last reply by Sinnbeck 3yrs ago
Ligonsker's avatar

How to merge 2 queries to work with pagination?

I currently have a query that sums the number of non-active users in the last year and groups them by country and city and then paginates the result: UserData::select( country, city, DB::raw('SUM(CASE WHEN end_date IS NULL THEN 0 ELSE 1 END) AS not_active'), ) ->whereBetween('created_at', [Carbon::now()->subYear(), C

Ligonsker's avatar
Ligonsker's avatar jlrdw3yrs agoCode Review
1
1
Last reply by jlrdw 3yrs ago
Rediska's avatar

How to get all data using pagination?

I ran into this issue and can't figure out how to solve it. There are, for example, 100 products. Each product has its own attributes. id title color size brand category 1 title1 red 30 adidas shoes 2 title2 black 30 puma shoes 3 title3 blue 28 puma

Rediska's avatar
Rediska's avatar jlrdw3yrs agoEloquent
10
1
Last reply by jlrdw 3yrs ago
Ligonsker's avatar

How to achieve best performance if I need both pagination and do collection methods on the full result set?

Hello, I think I had a similar question but this time it's with a different method: I have a pagination: $pagination = Model::paginate('300'); But I also need to do more actions on the result, but the full result, not paginated: $result->groupBy('column')->count(); But I don't have the full collection $result, only the paginated so in the case above it would only count

Ligonsker's avatar
Ligonsker's avatar Tray23yrs agoCode Review
3
2
Last reply by Tray2 3yrs 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.