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

Garethcollins's avatar

Pagination doesn't work with ajax in Laravel

I'm trying to make pagination with ajax in Laravel. But I have one problem. When I go to page2, the users aren't displayed. The similar questions are posted, but I can't still solve this problem. Could you please help me? The source below shows only necessary parts. ~app.blade.php~ @if(Auth::user()): <div class="modal fade" id="myModal" tabindex="

Garethcollins's avatar
Garethcollins's avatar Garethcoll...5yrs agoLaravel
1
1
Last reply by Garethcollins 5yrs ago
Berwyn's avatar

Pagination Link Breaks after Applying a Filter?

I have an issue after applying filters on my records. Essentially, once the filtering process is done the pagination links break and try to point to a page that doesn't exist. I'll try to give you the code step by step, let's start with the route: Route::post('/filter-leads', 'FiltersController@leadsFilter'); That gets sent all the filter criteria by AJAX. Next up is the contr

Berwyn's avatar
Berwyn's avatar Berwyn5yrs agoLaravel
3
1
Last reply by Berwyn 5yrs ago
BeginnerSoul's avatar

Huge pagination buttons

Hello Before update I didn't have huge buttons with pagination. I don't know what can be the reason. I get something like this: https://ibb.co/pvj01F3 https://ibb.co/R3CB5s2 What can be the problem? It is in the row and col-12: <div class="row"> <div class="col-12 d-flex justify-content-center pt-4"> <nav role=&qu

BeginnerSoul's avatar
BeginnerSoul's avatar jlrdw5yrs agoLaravel
15
1
Last reply by jlrdw 5yrs ago
johnw65's avatar

Pagination with two methods of navigation

I'm relatively new to Laravel and would like to implement pagination. For example, when a user performs a ajax search, it retrieves the record and populates a side menu with a list of full_name and date_travel: $.each(data.result.data, function(index) { counter = index + 1; $("#search_result").append('<li><a href="test/fetch/&

johnw65's avatar
johnw65's avatar johnw655yrs agoLaravel
0
1
datarecall's avatar

Livewire Pagination

When creating a custom pagination view, do you have any idea how I can add withQueryString() and page increment/decrement so bots can crawl it (google etc) this is what I am using for my custom pagination view currently: @if ($paginator->hasPages()) {{-- {{dd($paginator->nextPageUrl())}}--}} @if($paginator->hasMorePages()) <div class="load-new-re

datarecall's avatar
datarecall's avatar siddolo3yrs agoLivewire
7
1
Last reply by siddolo 3yrs ago
jesse_orange_newable's avatar

Laravel pagination in Vue.js

I am using Laravel's paginate method with Vue.js for a load more button, the pagination in my Vue component is an object like so: (this.pagination = { from: response.data.from, to: response.data.to, total: response.data.total, current_page: response.data.current_page, last_page: response.data.last_page, next_page_url: response.data.next_page_url, prev_page_url: r

jesse_orange_newable's avatar
jesse_orange_newable's avatar jesse_oran...5yrs agoGeneral
0
1
krunal05's avatar

Laravel 8 - Pagination not showing numbers

I am trying to do a pagination and it works. But in the pagination I am only getting « Previous Next » How to do pagination with laravel so that i can see number pagination < 1 2 3 > $users = User::where('id', '!=', Auth::id())->paginate(2); return view('users.index', ['users' => $users] ); In the blade {{ $u

krunal05's avatar
krunal05's avatar mahbubrn4yrs agoLaravel
19
1
Last reply by mahbubrn 4yrs ago
wahyu_87's avatar

How to write blade view with pagination

how to write in blade view table with pagination like this <table> <tr> <td rowspan='3' colspan='2' >Header article</td> <td>article 1</td> <td>article 2</td> </tr> <tr> <td>article 3</td> <td>article 4</td> </tr> <tr> <td>article 5</td> <t

wahyu_87's avatar
wahyu_87's avatar Snapey5yrs agoLaravel
10
1
Last reply by Snapey 5yrs ago
COUPDEGRACES's avatar

Where to edit template pagination default by laravel 8

Hi , im using laravel 8 . and my blog , i use pagination system to handle my table . but when im using {{ $data->links() }} I'm got output like Pagination.next and pagination.prev how i can custom text Pagination.next and pagination.prev

COUPDEGRACES's avatar
COUPDEGRACES's avatar bobbybouwm...5yrs agoLaravel
1
1
Last reply by bobbybouwmann 5yrs ago
mastermindlegion's avatar

Laravel pagination and resources problem

Hello guys, I have problem regarding to the pagination, where resuls are only displayed for the ?page=1 and if I try different page, only empty [] is returned. I guess I have to paginate AdvertisementResource Api Route: Route::get('/categories/{advertisementCategory:slug}', 'Advertisements\AdvertisementCategoryController@indexOneCategory'); Controller: public function indexO

mastermindlegion's avatar
mastermindlegion's avatar Graveman2yrs agoLaravel
2
1
Last reply by Graveman 2yrs ago
sagar001's avatar

How to pass somevalue to pagination links

Anybody know about passing boolean value with pagination link. {{ $product->links('vendor.pagination.tailwind') }}

sagar001's avatar
sagar001's avatar sagar0015yrs agoLaravel
5
1
Last reply by sagar001 5yrs ago
1x0's avatar

Pagination: count(id) instead of count(*)

Hi guys, Is it possible in Laravel to change the pagination query (only in specific cases) from: SELECT COUNT(*) AS aggregate... To: SELECT COUNT(id) AS aggregate...? We're still running a Laravel 4.2 project. Select count(id) will be a bit more efficient for the database. I couldn't find an answer to this question anywhere on the internet. Thank you.

1x0's avatar
1x0's avatar 1x05yrs agoLaravel
2
1
Last reply by 1x0 5yrs ago
BrianA's avatar

Hide/Show Bootstrap Table Columns When Using Laravel Pagination

Hi :) I am working on a Laravel project where I have a table containing tens of thousands of records, which I must display to the user in a blade view (in a table). Currently, I am using a function in the controller to get all records ($devices) from the table (devices table) using Laravel's pagination, as shown below: In the controller: public function index() { $devices =

BrianA's avatar
BrianA's avatar BrianA5yrs agoLaravel
4
5
Last reply by BrianA 5yrs ago
mahmoudtrageh's avatar

How can I remove metronic theme datatable pagination kt_datatable ?

How can I remove metronic theme datatable pagination kt_datatable ?

mahmoudtrageh's avatar
mahmoudtrageh's avatar prtkrj_135yrs agoLaravel
1
1
Last reply by prtkrj_13 5yrs ago
msaied's avatar

How To Make pagination without Parameter on URL ( Pretty URL pagination )

Hello I have quiz script so the user should answer every question and click on Next To See Next question I made this with pagination But the problem is the user can jump to other questions without answer it just by change ?page=X The parameter on URL, so I need a way to hide this Parameter I search but I didn't found any answer :)

msaied's avatar
msaied's avatar lfcallif5yrs agoLaravel
20
1
Last reply by lfcallif 5yrs ago
mahmoudtrageh's avatar

firestore pagination with laravel

I want to understand this code ?! how can I change this link (url) to fit pagination of any page ? $limit = 10; $url = 'https://firestore.googleapis.com/v1beta1/projects/zadcall/databases/(default)/documents/users? key=AIzaSyD8LI57uBNjHG_r8QWpSvt8DXsdd5S5eKw&pageSize='.$limit.'&pageToken='.$nextPageToken; $json = json_decode(file_get_co

mahmoudtrageh's avatar
mahmoudtrageh's avatar sammythebu...5yrs agoLaravel
3
2
Last reply by sammythebull 5yrs ago
eggplantSword's avatar

Element-ui table combine pagination and search

Is there a way I could combine these two examples to be able to not only search but have pagination on my Element-ui tables? These are the two examples, Search: https://codepen.io/AndrewThian/pen/QdeOVa?editors=1010 Pagination: https://codepen.io/reijnemans/pen/dyoaxGv This is my code, I have only implemented the pagination example <el-table :data="displayData"

eggplantSword's avatar
eggplantSword's avatar ShammasTA3yrs agoVue
8
139
Last reply by ShammasTA 3yrs ago
eggplantSword's avatar

Element-ui pagination with table

I'm wondering how I can use the pagination along with the table, and also not on the table. This is what I have so far <el-table :data="displayData" style="width: 100%"> <el-table-column prop="name" label="Nombre"> </el-table-column> </el-table> <div> <el-pagination

eggplantSword's avatar
eggplantSword's avatar msslgomez5yrs agoVue
4
7
Last reply by msslgomez 5yrs ago
webfuelcode's avatar

How to add the pagination on index

Using single thread list on index page with @include. How to use pagination on index as single page is working good. Index page is here @extends('layouts.front') @section('heading') <a href="{{route('thread.create')}}" class="btn btn-success float-right">Create Thread</a><br> @endsection @section('content') @include('layouts.partials

webfuelcode's avatar
webfuelcode's avatar Neeraj10055yrs agoLaravel
8
1
Last reply by Neeraj1005 5yrs ago
nguyenvanan's avatar

Custom display pagination laravel 5.2

I using laravel 5.2 and work with this pagination. How to change string » (mean next one page) to › 1|2|3|»|last page

nguyenvanan's avatar
nguyenvanan's avatar Sergiu175yrs agoLaravel
1
1
Last reply by Sergiu17 5yrs ago
datarecall's avatar

Pagination Problem + Eloquent Help

Help With Pagination I have a model called "supplier" and this model has many "products" Each product has a rating with is attached by a pivot table product_id / diary_id I am currently using this to get the $supplier ratings public function getRatingsAttribute() { return $this->products()->with('ratings.user')->get()->pluck('ratings'

datarecall's avatar
datarecall's avatar jlrdw5yrs agoGeneral
6
1
Last reply by jlrdw 5yrs ago
saadaan's avatar

Using pagination with datatables

Hi, I am using datatables to display a set of data as a table with options (download, search, etc). For the dataset being big, I have to use paginate() at controller level to divide the results. However, they do not make a good combination, because datatables applies its functions only to the data passed onto it (in my case, its the first 50 results). So, whatever functions dat

saadaan's avatar
saadaan's avatar MarianoMor...5yrs agoLaravel
3
1
Last reply by MarianoMoreyra 5yrs ago
noblemfd's avatar

view blade search filter and pagination disappears

In my Laravel-5.8 application, when i used DB raw and Query Builder, the pagination and search filters in the view blade datatable disappears. Controller $datas = DB::table('hr_employees AS e') ->leftJoin('appraisal_goals AS a', function($join) use ($identities) { $join->on('a.employee_id', '=', 'e.id')

noblemfd's avatar
noblemfd's avatar noblemfd5yrs agoLaravel
1
1
Last reply by noblemfd 5yrs ago
CookieMonster's avatar

pagination not disabled in last page

I want to make a pagination page on my page and I use pagination for laravel and pass the data to my vue template. It has a previous and next page to toggle it. In the first page, the previous button is disabled and when it reaches the last page, the next page is disabled. While my previous page works fine but when it reaches the last page, clicking next will bring me to page 1

CookieMonster's avatar
CookieMonster's avatar nickywan12...5yrs agoVue
8
1
Last reply by nickywan123 5yrs ago
markrailton's avatar

Having multiple tables with pagination on one page

I have a model called Student and on that have 2 HasMany relationships. In the student.show page I want to show 2 tables, 1 for each of the hasMany relationships. The model looks like: class Student extends Model { protected $guarded = []; public function sessions() { return $this->hasMany(Session::class); } public function sessionsPaginated()

markrailton's avatar
markrailton's avatar aurawindsu...5yrs agoLaravel
3
1
Last reply by aurawindsurfing 5yrs ago
clarg18's avatar

Pagination with search query

Controller: public function search(Request $request) { $stores = Store::with('router', 'tills', 'backOffices','contacts', 'storeStatus', 'storeStatus', 'storeType', 'scos', 'fuelBrand')->where('store_name', 'like', '%' . $request['find'] . '%')->paginate(13); return view('store.index')->with([ 'stores' => $stores, 'find' => $request['find'

clarg18's avatar
clarg18's avatar GlenUK5yrs agoGeneral
1
1
Last reply by GlenUK 5yrs ago
southcoastkenny's avatar

Transform on Paginated Collection removes Pagination

Hi, I'm trying to use transform with a paginated collection in livewire and it removes the pagination and only returns the items. $query = Tyre::where('status', 1); $rows = $query->paginate(25); $results = $rows->getCollection()->transform(function($row, $key) { $row->money = number_format($row->retail, 2); }); If i dump the data before the transform the colle

southcoastkenny's avatar
southcoastkenny's avatar tykus4yrs agoLaravel
14
7
Last reply by tykus 4yrs ago
andyandy's avatar

API Resources - Resource Collections - Pagination meta data disappear

I'm studying this https://laravel.com/docs/5.7/eloquent-resources This code will return 5 articles + pagination meta data (current page, last_page etc.) $publications = Publication::paginate(5); $publications = PublicationResource::collection($publications); return $publications; Great. Now I will generate resource for controlling collections of models.

andyandy's avatar
andyandy's avatar andyandy5yrs agoEloquent
2
6
Last reply by andyandy 5yrs ago
Lia97's avatar

Crashes when using Union and Pagination

I have code $medias = DB::connection('oracle')..... $materials = DB::connection('oracle')..... $union = $materials->union($medias); //pagination $page = Request::get('page', 1); $paginate = 50; $offSet = ($page * $paginate) - $paginate; $itemsForCurrentPage = array_slice($union, $offSet, $paginate, true); $union = n

Lia97's avatar
Lia97's avatar Lia975yrs agoLaravel
2
1
Last reply by Lia97 5yrs ago
undrwd's avatar

Pagination: Undefined property: Illuminate\Pagination\LengthAwarePaginator::$id

I'm having a pagination issue. The first 7 pages work fine, but I'm getting this error for anything past page=7. The query looks the same other than the offset. Any thoughts on what could be causing this?

undrwd's avatar
undrwd's avatar MichalOrav...5yrs agoLaravel
3
1
Last reply by MichalOravec 5yrs ago
mayuri0606's avatar

Why pagination shows all the content on every page?

I have added pagination as follows. But all the pages display the same content. Think that there are 8 records in the employee table. When I added the below code to my laravel project, on the first page it displays all 8 records and on the second page also it displays the same 8 records. It doesn't break the first 5 records to the first page and last 3 records to the second pag

mayuri0606's avatar
mayuri0606's avatar MichalOrav...5yrs agoLaravel
6
1
Last reply by MichalOravec 5yrs ago
SolomonRei's avatar

Filtering with Pagination

I've stumbled upon some troubles. I have 3 tables and have to make pagination fore each. But I get my data one request Controller if(\App\User::where('id', Auth::id())->first()->group_store == 'admin') $data = Proposal::all(); else $data = Proposal::where('user_id', Auth::id())->get(); $new = $data->filter(function ($item) { if ($item-

SolomonRei's avatar
SolomonRei's avatar Snapey5yrs agoLaravel
1
1
Last reply by Snapey 5yrs ago
PersonalHomePage's avatar

Laravel 7.x Search with Pagination

Hi, would anyone be able to walk me through doing a search with pagination in Laravel 7.x? For example I created this function in my UsersController: class UsersController extends Controller { public function index() { $data = User::paginate(25); return view('users.results', compact('data')); } } My User model gets the search request with this metho

PersonalHomePage's avatar
PersonalHomePage's avatar opanegro4yrs agoRequests
13
1
Last reply by opanegro 4yrs ago
Spiral's avatar

Pagination not working in vue js

i'm using vuejs plugin pagination for paginate the list but getting error You can see this Cannot read property "first name" undefined my vue js code is <table v-if="type=='list'" class="table table-bordered table-hover"> <thead> <tr> <th>Title</th> <th>User</th> <th>Birth D

Spiral's avatar
Spiral's avatar frankielee5yrs agoVue
5
1
Last reply by frankielee 5yrs ago
ollie_123's avatar

Pagination - No Links Showing

Evening All I'm stuck on something thats so simple but just baffling me. I'm trying to paginate some records but the pagination links don't appear. I've done a dd($completeOrders) and i can see the orders & pages detail etc but just no links in the view. Please could one of you kind folk advise where i might be going wrong or what i'm missing. //Controller $completeOrders

ollie_123's avatar
ollie_123's avatar oli_d1115yrs agoLaravel
8
1
Last reply by oli_d111 5yrs ago
ollie_123's avatar

Pagination - Call to undefined method App\Company::links()

Morning All Im trying to use Laravels pagination rather than datatables but am a bit stuck. I keep getting the above error and cant work out why... please could one of you kind folk advise. //Controller $company = \App\Company::paginate(2); return view ('admin.companies', compact('company')); //View @foreach ($company as $company) //Table @endforeach {{ $c

ollie_123's avatar
ollie_123's avatar oli_d1115yrs agoLaravel
2
1
Last reply by oli_d111 5yrs ago
jdebuchy's avatar

Pagination links() with request that are only built with key

I have a set of records that needs to be paginated. Based on a Laracast's lesson I added a popular filter that will sort by "most viewed" restaurants. This query doesn't have any value like popular=true, only a key. If my request is ?cuisine=pasta&popular&page=2 and I try to create pagination using {{ $restaurants->appends(request()->input())->links()

jdebuchy's avatar
jdebuchy's avatar jlrdw5yrs agoEloquent
3
1
Last reply by jlrdw 5yrs ago
jinsonjose's avatar

How to create a pagination in vue + laravel

i want a pagination like < 1-10 of 189 > like this how to handle this in vue ?? any package to handle this?? can you help??

jinsonjose's avatar
jinsonjose's avatar jinsonjose5yrs agoVue
2
1
Last reply by jinsonjose 5yrs ago
Chron's avatar

Are there any fuzzy search packages for laravel that support pagination?

I've tried https://github.com/TomLingham/Laravel-Searchy but it doesn't support pagination.

Chron's avatar
Chron's avatar Braunson6yrs agoLaravel
1
1
Last reply by Braunson 6yrs ago
cosminc's avatar

Applying pagination on a modified Eloquent collection

Hello, Because I can't apply some filters directly in the database I need to filter the resulting Eloquent collection and then apply pagination to it. Unfortunately ->paginate() doesn't work after you fetched the results with ->get() so I'm curious what are my options here. After doing some research I found this function that somehow solves my problem: public function pag

cosminc's avatar
cosminc's avatar cosminc6yrs agoEloquent
2
3
Last reply by cosminc 6yrs ago
miguellima's avatar

How to test pagination results?

Hello everyone, I'm doing some tests. And know I want to test pagination results of the users page does not contain users with role "admin". Only containing users with role "user". For example: I want to test page1 then page2 ... Is there a any way to do this? Thanks in advance

miguellima's avatar
miguellima's avatar guybrush_t...6yrs agoTesting
3
1
Last reply by guybrush_threepwood 6yrs ago
mastermindlegion's avatar

Pagination data[] changes to data{}

Hello guys, I got a problem regarding pagination. When i'm at the first ?page=1 data is [ ] and at the ?page=2 data is {}. Thank you very much I don't know how to proceed. Here is my controller: public function index(Request $request, Tag $tag) { $collection = ArticleResource::collection($tag->articles); return $collection->paginate(1); } ?page=1 respon

mastermindlegion's avatar
mastermindlegion's avatar tykus6yrs agoLaravel
5
1
Last reply by tykus 6yrs ago
Fly_Moe's avatar

Customize pagination

How do I customize the pagination to look similar to this. Using Laravel 6.0+. Any pointers? First Prev 1 2 3 4 5 ... 8 Next last

Fly_Moe's avatar
Fly_Moe's avatar jlrdw6yrs agoLaravel
2
1
Last reply by jlrdw 6yrs ago
frankone's avatar

query limit when using pagination

Hi there, i have a question, came across this issue, looked up on internet and i see many others with the same difficulty and didnt see any solution, maybe you have some advice? i have this app, which works with tables of products lets say, and i can create subsets (segments) of these products, based on some criteria. I can also limit the number of allowed items in a segment. S

frankone's avatar
frankone's avatar frankone6yrs agoEloquent
4
2
Last reply by frankone 6yrs ago
Drewlim7's avatar

Laravel unreadNotifications with pagination

May I know how to get unreadNotification with pagination? I managed to get all the notifications with paginations but I wasn't to get unReadNotification instead of readNotification. Is there any way to get this? I cannot find any similar from StackOverflow....

Drewlim7's avatar
Drewlim7's avatar Drewlim76yrs agoLaravel
0
1
Gabotronix's avatar

Custom/Extend laravel pagination method

Hi everybody, I use vue component for displaying data on my blade template layouts, like for example pagination data, that's why I created a method to return paginated data in the shape I need it, I was wondering if it's posible to chain or override laravel paginate method? Right now I'm doing it like this but I'd like to maybe extend laravel query builder or whatever classes l

Gabotronix's avatar
Gabotronix's avatar MichalOrav...6yrs agoGeneral
1
1
Last reply by MichalOravec 6yrs ago
Gabotronix's avatar

Automatically build laravel pagination object

Hi everybody, in my app each time I retrieve paginated results from the database I have to do somethig like this: $posts = Post::latest()->with(['category','user'])->paginate($request->input('paginate', 6)); $posts = [ 'data' => $posts, 'pagination' => [ 'total' => $posts->total(),

Gabotronix's avatar
Gabotronix's avatar MichalOrav...6yrs agoGeneral
2
1
Last reply by MichalOravec 6yrs ago
Sema314's avatar

Pagination on DB::table

Hi all, So I'm pulling in all 3000+ records from a DB table that I have called 'Employees', here is the method that I am using: Hi all, Is it possible to use native pagination on the DB::table()->get() method? Now, I have 3000+ records in a specific table, and I'd like to trigger pagination of 1000 records at a time. Here is the method that I have: public function refresh()

Sema314's avatar
Sema314's avatar MichalOrav...6yrs agoLaravel
1
1
Last reply by MichalOravec 6yrs ago
anon160124's avatar

Pagination album images

Hello, can anyone advise me how to do pagination in the model? I have an album with pictures and I would like to see, for example, 20 pictures. Thanks for help namespace App; use Illuminate\Database\Eloquent\Model; class Album extends Model { protected $fillable = [ 'title', 'text', 'image' ]; public function images() { return $this->hasMany('App\Image')->latest();

anon160124's avatar
anon160124's avatar Snapey6yrs agoLaravel
5
1
Last reply by Snapey 6yrs ago
dackl's avatar

sqlsrv pagination not working using withCount and orderBy

Hi, I'm trying to sort my collection with pagination by relation count. The first page ist working fine, all other pages are showing following Error: Invalid column name 'live'. Does anyone have a solution for this? My Code: $events = Event::withCount([ 'tags as live' => function ($query) { $query->where('tag_id', 11342); }

dackl's avatar
dackl's avatar dackl6yrs agoEloquent
1
1
Last reply by dackl 6yrs 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.