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

dionarap's avatar

Pagination with Ajax/Jquery

I'm trying to create a pagination of my comments with Ajax and Jquery so i can swap the pages without reloading the whole page. Unfortunately i encounter a 500 error using my current code. Can anyone where i've gone wrong and how i'd rectify the issue? Controller: public function getSingle($slug, Request $request) { //fetch from the database based on slug. $product = Product::w

dionarap's avatar
dionarap's avatar Cronix7yrs agoJavaScript
1
1
Last reply by Cronix 7yrs ago
Dev0ps's avatar

how to set mannual url (href) in pagination

i have a page which support both direct load and asyn ajax load when ever i load page directly its working fine with pagination http://127.0.0.1:8000/UID/gui454ui4g/Photos?page=2 but whenever i load page via ajax its not working due to link is changed. http://127.0.0.1:8000/cdPhotos?page=2 cdPhotos is my asyn route. how i set pagination url mannually force to get href url eve

Dev0ps's avatar
Dev0ps's avatar Cronix7yrs agoLaravel
3
1
Last reply by Cronix 7yrs ago
ncltours's avatar

redis pagination

How can I accomplish pagination in Redis database in laravel project? Examples are much appreciated

ncltours's avatar
ncltours's avatar jlrdw7yrs agoLaravel
1
1
Last reply by jlrdw 7yrs ago
winner1's avatar

chuck vs pagination! memory usage

as laravel doc says: If you need to process a lot (thousands) of Eloquent records, using the chunk command will allow you to do without eating all of your RAM: so what about pagination? for example is: DB::table('users')->paginate(15) same as User::chunk(15, function($users){foreach ($users as $user){..}}); in memory usage?

winner1's avatar
winner1's avatar LNCH7yrs agoEloquent
3
1
Last reply by LNCH 7yrs ago
omarco's avatar

Laravel 5.7 pagination with Join and Order by

I have this method in my model: public static function BasicsPagination($perPage = null) { $perPage = $perPage ?: self::$defaultPagination; return self::with(['users' => function ($query) { $query->where('active', 1) ->where('banned', 0) ->where('type', 'basic'); }])->orderBy('first', 'D

omarco's avatar
omarco's avatar bobbybouwm...7yrs agoLaravel
3
1
Last reply by bobbybouwmann 7yrs ago
petritr's avatar

Add pagination to my vue component

I have an component where i can search and display records: <input class="search ml-2" type="search" placeholder="Search" v-model="search"> .... <tr v-for="job in filteredList.slice(0, 10)"> .... .... </tr> How can i add an numbered pagination ?

petritr's avatar
petritr's avatar petritr7yrs agoLaravel
0
1
petritr's avatar

vue pagination

I have done an custom search witch works fine, i need to add pagination now, any good examples for pagination ? im new with Vue

petritr's avatar
petritr's avatar petritr7yrs agoVue
4
1
Last reply by petritr 7yrs ago
Devpat's avatar

Pagination Not Working.

<?php public function listCourses(Request $r) { $sort = $r->get('sort'); $category_id = $r->get('category_id'); $keyword = $r->input('filter'); $courses = $this->course_discovery->paginate(10); //PAGINATION NOT WORKING $courses = $this->course_discove

Devpat's avatar
Devpat's avatar Devpat7yrs agoLaravel
1
1
Last reply by Devpat 7yrs ago
Thilakar's avatar

How to use equivalent model pagination for solarium response.

Hi, I have done the Address information equivalent model with pagination to list out my database, but same pagination i need to use for the solarium response. Please help me any one to over come this.

Thilakar's avatar
Thilakar's avatar Thilakar7yrs agoLaravel
0
1
iGenezys's avatar

Multiple Pagination

Hi people. I saw the subject a lot of times but it didn"t satisfied me, so I'm asking here. I need to do a multiple pagination on a page. In this page I have two lists and need to have my pagination on each lists. Actually I did this in the controller : public function getDev(){ $devs = Developpement::where('id_categorie', 1)->paginate(1, ['*'], 'dev');

iGenezys's avatar
iGenezys's avatar iGenezys7yrs agoLaravel
6
1
Last reply by iGenezys 7yrs ago
sasafister's avatar

How to add pagination in Laravel Nova Tool?

So the problem is that Resources have pagination out of the box, but when you use Tool as custom Resource, then you don't have pagination. Do I have to use another npm package and do it manually, or use existing one that is used in Resources? Any idea about that?

sasafister's avatar
sasafister's avatar sasafister7yrs agoNova
5
1
Last reply by sasafister 7yrs ago
ssquare's avatar

Jquery datatable throws error as soon as I implement laravel pagination links

@foreach($users as $kv => $vv) <tr> <td>{{ $vv -> name}}</td> <td>{{ $vv-> address}}</td> <td>{{ city }}</td> <td> Actions <

ssquare's avatar
ssquare's avatar pardeepkum...7yrs agoLaravel
2
1
Last reply by pardeepkumar 7yrs ago
pranath's avatar

Pagination with whereNotIn

Hi, I have the following code in my UserRolesController and it works perfectly without pagination. public function index() { $users = User::all()->whereNotIn('email','[email protected]')->sortByDesc('created_at'); return view('users.index', compact('users')); } I would like to paginate the results while maintaining the same condition (i.

pranath's avatar
pranath's avatar pranath7yrs agoLaravel
4
1
Last reply by pranath 7yrs ago
leandromatos's avatar

How to change number of pages appear on pagination slide?

The default pagination of Laravel 5.6 has 8 items before three dots (...) and 2 after. How to change this size of 8 items? The pagination element too large in mobile viewport.

leandromatos's avatar
leandromatos's avatar jlrdw7yrs agoLaravel
6
1
Last reply by jlrdw 7yrs ago
petritr's avatar

How to do fast pagination

I need to do an pagination eg. Users::all() witch is the best approach? Fast and effect pagination ?

petritr's avatar
petritr's avatar aurawindsu...7yrs agoLaravel
4
1
Last reply by aurawindsurfing 7yrs ago
AbdulBazith's avatar

Is it Possible to replace pagination after ajax search in Laravel Like replacing body content in atable

Guys i am working with a project. i have view.blade which displays all record in tabular format. i wrote the tbody portion as separate partial This is my controller before search public function index() { $loc=Location_details::orderBy('created_at','desc')->paginate(10); return view('Location_details.view')->withloc($loc); } this is my Locatio

AbdulBazith's avatar
AbdulBazith's avatar AbdulBazit...7yrs agoLaravel
10
1
Last reply by AbdulBazith 7yrs ago
AbdulBazith's avatar

Ajax with seach Pagination in not working Laravel

Guys i am working with a project i am using search inajax This is my controller before search public function index() { $loc=Location_details::orderBy('created_at','desc')->paginate(10); return view('Location_details.view')->withloc($loc); } This is my partials 'tbody' @foreach($loc as $locs) <tr> <

AbdulBazith's avatar
AbdulBazith's avatar AbdulBazit...7yrs agoLaravel
13
1
Last reply by AbdulBazith 7yrs ago
neeonline's avatar

Pagination "Query\Builder could not be converted to string"

Hello all, I have a query with pagination that I need to parse the data before returning it in my API. What is the method to force the paginate to get the results so I can navigate through the data object and not lose the pagination links? This is an example code: $result = DB::table('table') ->where('column', $filterValue); if ($start && $end) { $start = Ca

neeonline's avatar
neeonline's avatar Cronix7yrs agoLaravel
3
1
Last reply by Cronix 7yrs ago
alirezaeshaqi's avatar

pagination and search

Hi, I am using laravel 5.4 and bootstrap 3 , I want use pagination and search . but I the pagination and search not working well. Here is my script code: $(document).ready(function() { $('#example').DataTable({ "searching": true, "paging": true, }); }); and HTML Code: @section('content') <h1> All Information</h1> <table id="exampl

alirezaeshaqi's avatar
alirezaeshaqi's avatar alirezaesh...7yrs agoLaravel
2
1
Last reply by alirezaeshaqi 7yrs ago
joshblevins's avatar

List Pagination

I am trying to add paginate to a query that has a relationship and when I add the pagination I get error Undefined property: Illuminate\Pagination\LengthAwarePaginator:: $company = Companies::with('employees')->find($company_id)->paginate( $perPage = 10, Input::get('search') );

joshblevins's avatar
joshblevins's avatar joshblevin...7yrs agoLaravel
6
1
Last reply by joshblevins 7yrs ago
habetsth's avatar

Ajax Pagination with Filter

Hi, I have some difficulties with my ajax pagination linked to a filter. Here's how it should work. The user can access via a specific page to a form. When clicking the submit button, a raw sql request is made in JS and a POST ajax request is achieved to get the results at the bottom of the page with a pagination menu. This part works. But I have some issues with the pagination

habetsth's avatar
habetsth's avatar habetsth7yrs agoLaravel
1
1
Last reply by habetsth 7yrs ago
tiagomatosweb's avatar

Pagination json structure

Hi all, I'm confusing about how should be the real pagination json structure. In the docs, it shows in two different ways. Please have a look on https://laravel.com/docs/5.6/pagination#converting-results-to-json and https://laravel.com/docs/5.6/eloquent-resources#pagination. Is it a mistake or is there a way to set pagination with links and meta keys? Cheers

tiagomatosweb's avatar
tiagomatosweb's avatar tiagomatos...7yrs agoLaravel
1
1
Last reply by tiagomatosweb 7yrs ago
AbdulBazith's avatar

Problem in ajax return date format, pagination and buttons (edit and delete) in laravel

Guys I am working in a project milkfarm Thisis my view.blade image before search Refer: https://imgur.com/a/6gSd7rd My view.blade <thead> <th>Date</th> <th>Time</th> <th>No of Litres (Lt)</th> <th>Note</th> <th>Action</th> </thead>

AbdulBazith's avatar
AbdulBazith's avatar AbdulBazit...7yrs agoLaravel
0
1
AbdulBazith's avatar

Problem in sum(fields) in pagination laravel

Guys iam working with project. i have given pagination and made to view.blade. i also add the total values in a single field and passed to view.blade that is sum('amount') where amount is column name in my table. My problem is the sum of the values are displayed page wise in the view.blade i need the grand total must be displayed in the end of the page thats enough. that is if

AbdulBazith's avatar
AbdulBazith's avatar Anthonynzu...6yrs agoLaravel
12
1
Last reply by Anthonynzube 6yrs ago
ahmedalahmed's avatar

override pagination data

How to override pagination data like : $products = Product::where('id', '>', 20)->select('id')->paginate(10); /* Now i need to replace each item in data with new one after adding some custom fields */

ahmedalahmed's avatar
ahmedalahmed's avatar ahmedalahm...7yrs agoEloquent
8
1
Last reply by ahmedalahmed 7yrs ago
thebigk's avatar

Why is my GET parameter 's' being replaced with 'query' in pagination?

I've a search box that makes a GET request through my /search/ route with parameter named s . So I've search urls like /search/?s=keyword1+keyword2. The problem happens when the results are paginated. I'm getting following pagination URLs /search?query=keyword1+keyword2&page=2 I've no clue why is my s parameter is getting replaced by query parameter. Does anyone have a clue

thebigk's avatar
thebigk's avatar jlrdw7yrs agoEloquent
1
1
Last reply by jlrdw 7yrs ago
chrisgrim's avatar

Pagination Buttons Not Showing

Hi All, I have gotten pagination working on other projects, but I am stumped with my latest one. I am using the code $brands = Brand::latest()->paginate(2); return view('brands.index', compact('brands')); and in the post I can see only 2 brands. If I change the number to 3 then I will see 3 brands. The problem is I can't see the numbers/links at the bottom to switch

chrisgrim's avatar
chrisgrim's avatar chrisgrim7yrs agoLaravel
9
1
Last reply by chrisgrim 7yrs ago
mitismirza's avatar

laravel heavy pagination

hi i put 1 million record in database and paginate it with any relation : public function index(){ $phones = Phone::latest()->paginate(10); return view('phones' , compact('phones') ); } and show it in blade: <tbody> @foreach($phones as $phone) <tr style="max-width: 1024px;">

mitismirza's avatar
mitismirza's avatar mitismirza7yrs agoEloquent
3
1
Last reply by mitismirza 7yrs ago
AlexanderKim's avatar

Ajax pagination not working

Tried to follow this tutorial: https://laraget.com/blog/how-to-create-an-ajax-pagination-using-laravel But had no success. When i click on a pagination link, i get the following error: [Deprecation] Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.

AlexanderKim's avatar
AlexanderKim's avatar Cronix7yrs agoLaravel
3
1
Last reply by Cronix 7yrs ago
toby's avatar

[L5.*] Pagination: Change URL query name "page" globally

Hi, almost a year ago, I asked, if it's possible to globally change the name for the page query attribute if you enable pagination: Instead of having a url like tickets?page=23 I wanted to translate this to tickets?seite=23. Therefore, I created a lil' helper function to do so. I also use the following snippet inside my routes/web.php file to rename the routes from tickets/new

toby's avatar
toby's avatar toby7yrs agoLaravel
2
1
Last reply by toby 7yrs ago
chriz74's avatar

Pagination HTML element (ul.pagination) takes forever to hide

I followed this tutorial for implementing infinte scroll: https://laraget.com/blog/implementing-infinite-scroll-pagination-using-laravel-and-jscroll It works however the pagination links do not get hidden in time. the code used in the script is $('ul.pagination').hide(); If I scroll down I can see them and they disappear after 1 or 2 seconds. Obviously this is ugly. Any clue? I

chriz74's avatar
chriz74's avatar chriz747yrs agoLaravel
7
1
Last reply by chriz74 7yrs ago
LaraBABA's avatar

Laravel 5.5 API pagination

Hello, I would like to know if there is a simply way to generate a Json Pagination when building an API using Laravel 5.5. I was trying to create a pagination using a framework called Framework 7 but it is so difficult(and I am running out of time),that I was hoping for another solution, having the pagination done via Json instead so I can simply pull these 3 below urls in my b

LaraBABA's avatar
LaraBABA's avatar badmanlive7yrs agoLaravel
5
1
Last reply by badmanlive 7yrs ago
paulsantos's avatar

Pagination with a large table

I have a MySQL table with around 50,000 rows and using query builder's magic method paginate(). It works but kind of slow. So, I began searching on how can I optimize the code to make it load faster. I found out that behind the scene, paginate() counts the total number of rows in my table first before it actually pulls the right data using skip() and take() functions. In my c

paulsantos's avatar
paulsantos's avatar jlrdw7yrs agoEloquent
11
2
Last reply by jlrdw 7yrs ago
payter's avatar

Caching pagination aggregate count result

Hi, is somehow possible to cache count result for pagination query? select count(*) as aggregate from table_name I have table with 2 000 000+ and it tooks ~300ms every time to calculate this count. Cache this result for 1 hour would be sufficient solution, thank you!

payter's avatar
payter's avatar bobbybouwm...7yrs agoEloquent
4
1
Last reply by bobbybouwmann 7yrs ago
AlexanderKim's avatar

Filtering data with selected order and returning data with pagination

Blade: <select id="price_sort" class="custom-select" name="price_sort"> <option value="default" selected>By price</option> <option value="asc">Ascending</option> <option value="desc&qu

AlexanderKim's avatar
AlexanderKim's avatar AlexanderK...7yrs agoLaravel
2
1
Last reply by AlexanderKim 7yrs ago
Nameless_0's avatar

Laravel 5.5 - Trying to display some data from another table with pagination

Hi everyone. I have this crud app but I want to display some data from my other table (inventory table). I am using pagination Here is my Employee Controller: <?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Http\Requests; use App\Employee; use App\Http\Resources\Employee as EmployeeResource; class EmployeeController extends Controller { /**

Nameless_0's avatar
Nameless_0's avatar Nameless_07yrs agoEloquent
9
1
Last reply by Nameless_0 7yrs ago
ondes's avatar

Multiple custom paginations & pagination links problem

Hello everyone! I desperately need help with some issue with i have, concerning multiple paginations (2 paginations) on one page and links of pagination are not working properly. Situation is following: I got eloquent object- i sort it and do some process, then i converit it to 2 separate collections- now i have two collections which i have transfered by "Lengthawarepagina

ondes's avatar
ondes's avatar jlrdw7yrs agoLaravel
6
1
Last reply by jlrdw 7yrs ago
crnkovic's avatar

Approach to the infinite scroll pagination combined with sorting and filtering

Hi fellow Artisans, I've been building this app and during the development process I figured I need "filtering". What I mean by that is literally a sidebar with some checkboxes, dropdowns, etc, similar to the lessons page here on Casts. I also need to sort data by newest, oldest, etc. So the sidebar consists of a search bar, filters and sorting options and the main co

crnkovic's avatar
crnkovic's avatar crnkovic7yrs agoLaravel
2
1
Last reply by crnkovic 7yrs ago
MartiX's avatar

Pagination not working on live server (apache)

Hi guys, I've been working on Laravel web app quite a while, now it's time to deploy the site, but a strange problem occurs. Everythings works fine on development server, but the pagination seems broken on live server. This is the route: Route::get('/articles/{category}', 'ArticlesController@index'); Now the pagination add to URL this "?page=2", which is okay and wor

MartiX's avatar
MartiX's avatar Wilsonabdi...1yr agoServers
3
1
Last reply by Wilsonabdiel 1yr ago
trogne's avatar

pagination , filter lost on other pages

I have a pagination set up for all threads, with 10 threads per page. When I filter by popular threads, when I go to other pages, I lost the popular filter. For instance, on the first page I get the first 10 most popular threads, but when I go to page 2, it's the second page of all threads, regardless of the popular filter. How can I have a pagination that takes into account my

trogne's avatar
trogne's avatar BernardoBF...3yrs agoLaravel
11
1
Last reply by BernardoBF4 3yrs ago
gaan10's avatar

Pagination for the view is not working in laravel5.3

I am trying to use pagination for my view pages but getting error as : Call to a member function links() on array Limiting to display records using paginate in controller is fine,but issue is when passing to the view. Controller code is: $referredProcedureBookings = Gateway::procedurebooking()->getReferredProcedureBooking()->paginate(5); $new_records = [];

gaan10's avatar
gaan10's avatar ts7yrs agoLaravel
2
1
Last reply by ts 7yrs ago
if9477552's avatar

Help with VueJS Component for pagination

Hi everyone, I need some help with pagination, i'm using this component: http://hootlex.github.io/vuejs-paginator/ But i'm facing a problem with the resource_url, I don't understand very well how i'm suppossed to use this resource_url, I have a method in a controller that returns some clients registered in the database based on some information that the user has to enter, for e

if9477552's avatar
if9477552's avatar amirhazz7yrs agoVue
1
1
Last reply by amirhazz 7yrs ago
AbdulBazith's avatar

Pagination problem in search option in Laravel

I am having a textbox which searches the data and displays in tabular format. The search box works when I type any text it in that is it works in “Onkeyup” event written in Ajax . When the view page loads all the data are displayed to the user. I have given pagination for the view. When the user type any name in the search box it goes to the function in controller by Ajax call

AbdulBazith's avatar
AbdulBazith's avatar Assad Yaqo...1yr agoLaravel
6
1
Last reply by Assad Yaqoob 1yr ago
wilco's avatar

Laravel Vue pagination, adding comment to thread

I'm trying to re-create a similar pagination as in this video: Click Inhere, the following happens: You submit the form (that's in its own 'new-reply' component), the 'onSubmit' method gets triggered Inhere, you post the data with axios, and emit 'data' to the 'replies' component. The replies component contains this: <new-reply @created="add"></new-comment&g

wilco's avatar
wilco's avatar wilco8yrs agoVue
0
1
kaiden's avatar

get pagination value from a session

making pagination with laravel is easy. however when you begin to modify somethings things get tangled. i want to get pagination value from a session not from post data via URL. well, i did not tried anything yet because i couldnt set up a roadmap. i know how to put a session and how to retrieve it but how i am gonna embed it into links() method? Thats how my simple pagination

kaiden's avatar
kaiden's avatar Snapey8yrs agoLaravel
14
1
Last reply by Snapey 8yrs ago
kaiden's avatar

change default pagination view to default.blade.php

you know laravel uses bootstrap-4.blade.php pagination which resides in Illuminate/pagination/resources/views route as default pagination view. How to change this to its next sibling (default.blade.php)?

kaiden's avatar
kaiden's avatar Negus2yrs agoLaravel
5
1
Last reply by Negus 2yrs ago
SNaRe's avatar

How to use Laravel Collection groupBy along with Query Pagination? Ask Question

I love using Laravel's groupBy function https://laravel.com/docs/5.6/collections#method-groupby However, I cannot use it with paginate(x) function since it return a limited number of results. Groupby of SQL Query and Laravel Collections's GroupBy is totally different. If I use groupby in my query it doesn't give me what I want. For instance I just want to type and I got all I w

SNaRe's avatar
SNaRe's avatar SNaRe8yrs agoLaravel
0
1
zanakka's avatar

Retrieving products by category with pagination

Hi, I have 'products' and 'product_categories' tables in my database. Currently I have over 150,000 records in product_categories table. And I need to add 3 where criteria in the query at 'products' table. So my query is like that - select * from `products` left join `product_category` on `product_category`.`product_id` = `products`.`product_id` where `products`.`col_1` = 'va

zanakka's avatar
zanakka's avatar ksparkar8yrs agoLaravel
3
1
Last reply by ksparkar 8yrs ago
fredemagi's avatar

Advanced search, based on filters, pagination, and preservation of old input

I'm working on a search function on a website where users can search for other users based on filters like genders, areas, etc. I face several difficulties when coding: I cannot seem to figure out how to combine pagination with the collection, I get back. I make us of https://github.com/spatie/laravel-paginateroute for pagination. The problem is that when I go to page 2, I'm

fredemagi's avatar
fredemagi's avatar fouladgar_...7yrs agoLaravel
4
1
Last reply by fouladgar_dev 7yrs ago
muraligk's avatar

Laravel Pagination Host URL

Hi, I'm using Laravel 5.6 pagination for my API's, Its working fine in my local. But when I host it on the server, I'm getting the load balancer URL instead of my domain name for next and previous page URLs. I'm using AWS cloud hosting using cloud front and a load balancer. The next and previous page URL's are like this, http://-lb-01-*.ap--1.elb.amazonaws.com/api/v1/products?

muraligk's avatar
muraligk's avatar muraligk8yrs agoLaravel
0
1

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.