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

ksharifi's avatar

Pagination Issue

Hello Guys, I'm wondering for a wierd issue while using laravel pagination. i wrote this code block: Route::get('products/{categoryId?}', function($categoryId = null) { if($categoryId) { $products = \App\Product::where('active', 'y') ->where('category_id', $categoryId) ->paginate(12); } else { $products = \App\Product::where('ac

ksharifi's avatar
ksharifi's avatar veve28610yrs agoEloquent
5
1
Last reply by veve286 10yrs ago
arnabrahman's avatar

Laravel manual pagination

I've a collection. I want to use manual pagination to show this in my view. Can anyone give me an example

arnabrahman's avatar
arnabrahman's avatar arnabrahma...10yrs agoTips
3
6
Last reply by arnabrahman 10yrs ago
daniel-arias's avatar

Render only one table of the pagination

this is my actually controller class ProblemaController extends Controller { public function show($id) { $problema = Problema::findOrFail($id); $casos = DB::table('caso')->paginate(1); $comentarios = DB::table('comentario')->paginate(2); $pistas = DB::table('pista')->paginate(7); return view('problema.show')->with('problema', $problema)

daniel-arias's avatar
daniel-arias's avatar daniel-ari...10yrs agoLaravel
0
1
lipa's avatar

Pagination doesn't work

I'm trying to create simple pagination but I get error: Undefined property: Illuminate\Pagination\Paginator::$name (View: /home/lipa/php/awsomelink/app/views/user/index.blade.php) My controller: $user = User::with('urls')->find($id)->paginate(10); My View: @foreach($user->urls as $link) <li> {{ HTML::link($link->shortened, "awsomelink.com/$link->

lipa's avatar
lipa's avatar lipa10yrs agoLaravel
6
1
Last reply by lipa 10yrs ago
PascalSchwientek's avatar

[BUG] wrong pagination links

Hello, the pagination links on the watch later page are not correct. https://laracasts.com/saves

PascalSchwientek's avatar
PascalSchwientek's avatar PascalSchw...10yrs agoFeedback
0
1
Russtafar's avatar

Make pagination links always show

Just starting with Laravel's pagination platform, (omg its so beautifully simple). But one question. Is there a way to make the pagination links always show, even if the limit is not met? So if the limit is 5, but there's only 4, to show disabled pagination links instead of nothing. Thank-you!

Russtafar's avatar
Russtafar's avatar handy_man10yrs agoEloquent
2
1
Last reply by handy_man 10yrs ago
majacirkova's avatar

Pagination Laravel

Hello guys, I m using nayjest data grid in my project with pagination also i need to store some input fields from first page and to transfer to second page and so on , can you tell me how to do that ? Thanks Maja

majacirkova's avatar
majacirkova's avatar majacirkov...10yrs agoLaravel
2
1
Last reply by majacirkova 10yrs ago
stretch0's avatar

Simple pagination next / previous URL's with existing query string.

I am trying to use simple pagination as well as sending a GET request with a query string. This works fine and results are being returned normally however, the next and previous URL's are generated without the GET query. For example, my GET request may look something like this: http://dash.app/adcampaign/?page=1&campaign_status=active but the next URL returned is: http://d

stretch0's avatar
stretch0's avatar stretch010yrs agoLaravel
5
1
Last reply by stretch0 10yrs ago
Mushr00m's avatar

L5.1 Pagination config view gone

Hi, For a specific design I can't use the way Laravel 5.1 display the pagination link. I need to change the chevrons for next and previous links to a text translated. In L4.2 I was using the view config file to use a custom view that did that but it's gone on L5.1. I read some are using a presenter that they pass each time they call the render(), but it's not very convenient to

Mushr00m's avatar
Mushr00m's avatar jlrdw10yrs agoGeneral
3
1
Last reply by jlrdw 10yrs ago
RavenFaramond's avatar

Simple Pagination ignores link labels

Hey there. I'm using simplePaginate() on a query and render it with no problems but the text for buttons are disregarded. Laravel doesn't pay attention to the pagination.php file in language folders. As I dug deeper, I eventually reached BootstrapThreeNextPreviousButtonRendererTrait which has the getPreviousButton and getNextButton methods. I'm assuming these methods are used b

RavenFaramond's avatar
RavenFaramond's avatar jlrdw10yrs agoLaravel
3
1
Last reply by jlrdw 10yrs ago
missionaire's avatar

Laravel Reading from API with Limits and Displaying onto View with Pagination

Hi I am a little confused on how can I read from an api with page item limited display and then paginate them onto view with the pagination, such that when I click on the pagination link on the view to view next page, the display will be able to show based on the data from the api? Here is the scenario of what I am doing, I have an api link that is like this: http://localhost:8

missionaire's avatar
missionaire's avatar missionair...10yrs agoLaravel
0
1
saimiris's avatar

Column sorting with pagination on Laravel 5.1

Hi there, What is the simplest and fastest way to get links on the top of sorting paginated columns lists? I tried this package https://github.com/Kyslik/column-sortable that seemt good but I got this error https://github.com/Kyslik/column-sortable/issues/7 I need the solution to support pages number on sorting links, to support sorting criteria on pagination links and to suppo

saimiris's avatar
saimiris's avatar jlrdw7yrs agoLaravel
30
1
Last reply by jlrdw 7yrs ago
sandygajera's avatar

Slider Pagination Show Only previous,next and 1,2,3,4,5 only

I Use Pagination Slider-3 in view.php but when in database record is 100 then i display 10 record in each pagination and in pagination show < (previous) , 1 ,2 ,3 4,5,6,7,8,......,>(next) but i want to show 1 to 5 only each and every time with previous and next show not show 6,7,8 each and every time so it there any change in Illuminate\Pagination folder Paginator.php or

sandygajera's avatar
sandygajera's avatar sandygajer...10yrs agoLaravel
0
1
jishadp's avatar

Laravel5 Pagination Links Getting 404 Error

I developed a laravel web application and created a pagination view of business list... I have two business rows in my business table and collecting each one row in a view give pagination for accessing others... Controller.. public function businessindex(){ $arr = DB::table('business')->paginate(1); $arr->setPath('business'); return View::make('admin.SABC.busi

jishadp's avatar
jishadp's avatar bugsysha10yrs agoLaravel
1
1
Last reply by bugsysha 10yrs ago
dirkolbrich's avatar

BUG: Pagination broken?

Is the pagination broken? On the latest lesson "Unit Testing" I follow the Tags link and get to 'https://laracasts.com/index/testing?page=1'. Clicking the pagination an the buttom should show more recent lessons. But 'https://laracasts.com/index/testing?page=2" and so on will list the same lessons as pagination 1.

dirkolbrich's avatar
dirkolbrich's avatar layer710yrs agoFeedback
3
1
Last reply by layer7 10yrs ago
bobbybouwmann's avatar

Empty second pagination page

Hi, I found a bug with threads that have 15 replies and a correct answer. For example, take the following post: https://laracasts.com/discuss/channels/envoyer/envoyerio-forge?page=2#reply-99761 As you can see it links to page 2 while there is only one page. When you change the url to page=1 (or remote it) you don't see any pagination so that is correct! However in the overview

bobbybouwmann's avatar
bobbybouwmann's avatar bobbybouwm...10yrs agoFeedback
6
1
Last reply by bobbybouwmann 10yrs ago
david001's avatar

500 (Internal Server Error) Laravel--ajax Pagination

iam getting 500 (Internal Server Error) when i click the links of pagination and donot have an idea to fix it My view @extends('layouts.master') <head> <head><meta id="token" name="token" content="{ { csrf_token() } }"></head> <title>Laravel AJAX Pagination with JQuery</title> </head> @section('co

david001's avatar
david001's avatar david00110yrs agoLaravel
6
1
Last reply by david001 10yrs ago
joedawson's avatar

Pagination Help/Logic

Hello all, I'm unsure of how to tackle pagination for a bunch of photos at the following routes: /photos /photos/popular /profiles/{slug}/photos Lets say from /photos, I click the first photo. On this page /photos/1 I navigate to the next photo which is now /photos/2. This is fine. But if I now navigate to /photos/popular and click the first photo, which is potentially /photos

joedawson's avatar
joedawson's avatar JoeDawson10yrs agoLaravel
16
1
Last reply by JoeDawson 10yrs ago
Mithridates's avatar

laravel pagination showing current items count numbers

I have implemented pagination successfully. Right now according to current page I wanna show a sentence like: Showing 15 to 30 of 57 entries which 15 is starting items number in table 30 is last item number and 57 is all items count Does anybody know how I get this

Mithridates's avatar
Mithridates's avatar azer5yrs agoLaravel
8
1
Last reply by azer 5yrs ago
david001's avatar

How to make pagination wih Laravel5 and Anjular

Iam new to Angular js and have no much idea of it,But i will practice it in my free time and this is my first angular+laravel work where i want to paginate data.But iam facing prolem.Can any one provide me codes or help me to correct the code mention below.. Iam following this tutorialhttp://blog.kettle.io/dynamic-pagination-angularjs-laravel/ controller <?php namespace App

david001's avatar
david001's avatar arvind9yrs agoLaravel
4
1
Last reply by arvind 9yrs ago
Gevp's avatar

Pagination + Postgres + Order By = help.

Hi, So I'm using postgres driver, this is an issue related to Order By and aggregated functions. So when I attempt to make a paginator on an orderder query(Eloquent, Relation or QB), I have this abstracted in a repository pattern, so any of these could require a pagination. I tried to send back sorted results, and I came up with the issue. Currently I have a horrible workaround

Gevp's avatar
Gevp's avatar Gevp10yrs agoCode Review
0
1
ianjamieson's avatar

Pagination in Lumen?

Hi, I'm trying out lumen for a simple php API project. I've used laravel in the past and don't seem to have a problem here, but in Lumen, I can't seem to get pagination working. Here's my controller <?php namespace App\Http\Controllers; use Laravel\Lumen\Routing\Controller as ApiController; use Illuminate\Support\Facades\DB; use Cdr; class CdrsController extends ApiControl

ianjamieson's avatar
ianjamieson's avatar kamleshcgt...5yrs agoLumen
3
1
Last reply by kamleshcgtechno 5yrs ago
Man's avatar

Change simple Pagination

I am new to laravel and working on an established code. I am trying to change from simple pagination (<) (>) to using regular pagination: (<)12345...789(>). Currently this is what my pagination.php uses: php echo $media->render(); ?> How can I change this to use a standard pagination instead of a simple one?

Man's avatar
Man's avatar RachidLaas...10yrs agoCode Review
1
1
Last reply by RachidLaasri 10yrs ago
nazar1987's avatar

pagination with union in Laravel

i have problem when try pagination tow union table $page = Input::get('page', 1); $paginate = 10; $members = DB::table("members") ->select("id", "first_name", "last_name", "email", "created_at") ->where("site_id", $id); $users = DB::table("users") ->se

nazar1987's avatar
nazar1987's avatar munazzil7yrs agoLaravel
7
1
Last reply by munazzil 7yrs ago
davorminchorov's avatar

"My Favorites" list pagination links don't change pages when clicked.

Hey Jeffrey, I was looking for a favorite thread and didn't find it in the first page. When I clicked on the pagination links, the page just refreshed without showing the favorite threads on page 2.

davorminchorov's avatar
davorminchorov's avatar JeffreyWay10yrs agoFeedback
3
1
Last reply by JeffreyWay 10yrs ago
kickthemooon's avatar

[HELP] Raw query of a MySQL stored procedure - Pagination?

I have this query: $images = DB::select('call spMultimedia(' . $id . ')'); I need pagination for these results. Can i use paginate?

kickthemooon's avatar
kickthemooon's avatar sylar10yrs agoEloquent
1
1
Last reply by sylar 10yrs ago
Croisciento's avatar

Pagination with many to many relationships

Hey, I've been trying to figure how to set a pagination system when you have many to many relationships. Basically I got 3 tables. articles, promotions and article_promotion. An article is created by an user and he can pick up a promotion which has a starting and ending date. The index view should be retrieving all the articles where one of its promotion associated has its endi

Croisciento's avatar
Croisciento's avatar Croiscient...10yrs agoLaravel
2
1
Last reply by Croisciento 10yrs ago
cmpe's avatar

Forum discussion pagination at the top too?

Unless I'm derp'ing here (and I admit it's definitely a possibility) and missing a simple way to do this, I don't believe there is a way to navigate to different pages of a discussion thread until I get to the pagination at the bottom. Not sure if this is by design to make you "check" all the posts before being able to jump over to a different page of the discussion?

cmpe's avatar
cmpe's avatar chrisburto...10yrs agoFeedback
7
1
Last reply by chrisburton 10yrs ago
handy_man's avatar

pagination works locally but not in production?

I have a simple logging system that logs information about when a user did things (added a reservation, edit, delete etc). Logs as you can imagine get a bit large, so I decided to paginate my data and this works fine on my local development environment (Windows with XAMPP) but not in my production environment (Ubuntu 14.04 with Nginx web server). My Controller: public funct

handy_man's avatar
handy_man's avatar handy_man10yrs agoGeneral
2
1
Last reply by handy_man 10yrs ago
elieandraos's avatar

Eager Loading + Restriction + Pagination

I have a small application on Laravel 5.1 that has a polymorphic relations. So in a certain part of the app, I have a "Title' that is themable. I am trying to get all titles belonging to specific themes (tags) based on the theme ids. I am using eager loading to get the list, but the problem is that the query is returning all the titles. Example code: $titles = Title::with(

elieandraos's avatar
elieandraos's avatar elieandrao...10yrs agoEloquent
0
1
ackuang's avatar

Persists checkbox value through pagination (Laravel 4)

http://stackoverflow.com/questions/17929060/how-to-persist-checked-items-across-pagination-requests-in-laravel I try to implement using answer in the link above but seems not working. I am unable to keep the checkbox values with pagination. There is a form after collecting all checkbox, then only post the form together with checkbox. My code as follows: View: {{ Form::open(arra

ackuang's avatar
ackuang's avatar ackuang10yrs agoGeneral
1
1
Last reply by ackuang 10yrs ago
giwrgos's avatar

How I can have multi pagination on one page

Hello, on my system that i'm working now I have 2 tables in one page. Each table has different information from the other but both have 10 rows. I want to have different paginations for the two tables so user can move to the next rows of the table. For example if he use the pagination of the first table to move to the page 2 of the first table and show the next 10 available row

giwrgos's avatar
giwrgos's avatar cleopatria10yrs agoGeneral
6
1
Last reply by cleopatria 10yrs ago
gabahulk's avatar

Pagination of array not working

Hello! I need to paginate an array of data and the render method works, the url is correct but they always show the same items! $items= new Paginator($items,20); return View::make('transactions.backpack')->with('items', $items); I tried to use the array_slice method but then the pagination does't work (because it's always the last page) I am almost sure that I am not usi

gabahulk's avatar
gabahulk's avatar gabahulk10yrs agoLaravel
2
1
Last reply by gabahulk 10yrs ago
krzystof's avatar

Pagination link redirection

@JeffreyWay A click on the pagination link of my "Watch later" redirects to the "/discuss?" url. Is it the right place to post about this?

krzystof's avatar
krzystof's avatar krzystof10yrs agoFeedback
0
1
DanSmith's avatar

Pagination bug

Hi Jeffrey, Just noticed a glitch with the pagination links when browsing through lessons on the site. When visiting https://laracasts.com/lessons I get 23 pages of content. As I go through each page, the total number of pages available decreases by 1, making it impossible to get to the later pages. If I manually go to the last page, I get no pagination links at all: https://la

DanSmith's avatar
DanSmith's avatar jlrdw10yrs agoFeedback
2
1
Last reply by jlrdw 10yrs ago
paboo's avatar

how do i change the base link pagination in laravel 5.1.6

this my Controller public function getHome(){ $pagination= DB::table('users')->paginate(2); $adc = DB::table('users') ->join('addresss','users.id','=','addresss.user_id') ->join('points','users.id','=','points.user_id') ->select('users.*','addresss.address','points.points')->get(); return V

paboo's avatar
paboo's avatar paboo10yrs agoLaravel
1
2
Last reply by paboo 10yrs ago
miro4994's avatar

Pagination - many rows + offset = slow performance

Hey guys. I have a table with 1 milion rows which i want to paginate. The pagination works fine until you reach around 1000+ pages then it´s slowing down and around 10000 page it´s not able to even generate the view and the app will crash down or it takes around 30 seconds to load because of the large offset. The only problem here is the offset included in the query. The greate

miro4994's avatar
miro4994's avatar uwajacques9yrs agoLaravel
8
1
Last reply by uwajacques 9yrs ago
anon12822's avatar

Creating Pagination Options

I'm looking at creating a pagination to view my users, however I want to be able to view my users by all active, deleted (soft deleted), and all together. I was wondering if there was any better way to approach this than what I am currently doing. Admin/UsersController Controller public function index(Request $request) { $allowed = [ 'deleted' =>

anon12822's avatar
anon12822's avatar anon1282210yrs agoCode Review
0
1
chrisblackwell's avatar

Pagination not working

I have a small function that gets my inventory items, and paginates them. public function getInventoryStatus(Request $request, $type = 'boat') { $filters = $this->cleanFilters($request->all()); $filters['type'] = $type; $dealer = (array_key_exists('dealerid', $filters)) ? null : array(3,45); $inventory = InventoryItem::with('status')->filterInventor

chrisblackwell's avatar
chrisblackwell's avatar JordanDalt...10yrs agoLaravel
2
1
Last reply by JordanDalton 10yrs ago
asker's avatar

Wrong Pagination rendering

Hi, I have a problem with pagination links. I have a pagination on link: http://localhost/laravel3/public/tours I have this code in Blade: {!! $item->render() !!} and pagination works fine except that Next and Prev links go to the: http://localhost/laravel3/public/tours/?page=2 instead of correct link http://localhost/laravel3/public/tours?page=2 Any help?

asker's avatar
asker's avatar pmall10yrs agoLaravel
6
1
Last reply by pmall 10yrs ago
Usual's avatar

Use pagination in POST request.

I am coding a contact search system by laravel, and use pagination to pagine search results.So when I post a form to url like "search/contact", the system works and display right results and right pagination links in page.But then, when I click the page links with a url like "search/contact/?page=7", a GET request is sent by browser, consequently I lose my s

Usual's avatar
Usual's avatar kamaya10yrs agoLaravel
10
1
Last reply by kamaya 10yrs ago
krex's avatar

Cache forever using tags and pagination

Hi, I want to Cache forever using cache tags like this: Cache::tags('news')->rememberForever('allposts', function(){ return Article::with('image', 'category')->IsPublished()->Published()->latest('published_at')->paginate(8); }); But in the cached result there are only first 8 records and pagination doesn't work. How to cache all of the posts and then

krex's avatar
krex's avatar krex10yrs agoLaravel
1
1
Last reply by krex 10yrs ago
dydx's avatar

Weird pagination issue and non-root URLs

I'm having a very strange problem with pagination with non-root URLs. The URL: http://local.dev/?page=3 is paginated correctly, showing the correct bit of database info for page 3. The URL: http://local.dev/test/?page=3 is not paginated correctly, while the URL does suggest it's calling the right information, the page is still displaying the information for page 1. Before I nar

dydx's avatar
dydx's avatar dydx10yrs agoLaravel
5
1
Last reply by dydx 10yrs ago
kay899's avatar

Jump back to previous Pagination page

Hi, I use Pagination in my Backend. When I chose an item on let's say page 3 and edit this, then after saving, Laravel leads be back to the first page of the Pagination. Is there any trick to get back on page 3 again? Thanks kay899

kay899's avatar
kay899's avatar jlrdw9yrs agoLaravel
4
1
Last reply by jlrdw 9yrs ago
kinshara's avatar

Pagination in laravel 5

I want to make my own style pagination.. in laravel 4.2 //in view {{ $data->link('urlToView'); //my own view <?php $presenter = new Illuminate\Pagination\BootstrapPresenter($paginator); $trans = $environment->getTranslator(); ?> <?php if ($paginator->getLastPage() > 1): ?> <ul class="own-pagination"> <?php

kinshara's avatar
kinshara's avatar bobbybouwm...11yrs agoCode Review
1
1
Last reply by bobbybouwmann 11yrs ago
LovelyBoy's avatar

Restfull Api Pagination Help

How can we create pagination in Restfull Api ? My Controller try { $response = [ 'users' => [] ]; $statusCode = ""; $users = User::all()->take(5); foreach($users as $user){ $response['users'][] = [ 'id' => $user->id, 'username' => $user->name, 'lastname' => $user->lastname,

LovelyBoy's avatar
LovelyBoy's avatar jlrdw11yrs agoGeneral
3
1
Last reply by jlrdw 11yrs ago
NeoNe's avatar

Vue.js + Laravel pagination

I just fall in love with Vue.js thanks to Jeff for reviling Vue to me and such great tutorials here at Laracasts. Vue.js is simple fast and easy to understand well everything here is easy to understand thanks to Jeff :). but for my taste is better then Angular and actually is based on Angular but the only difference is that there is no need for recreate Laravel controllers and

NeoNe's avatar
NeoNe's avatar murilo9yrs agoVue
11
1
Last reply by murilo 9yrs ago
andrewjroberts's avatar

VueJS & Pagination

Has anyone had any experience with implementing pagination with VueJS? As their seems to be no plugins available for pagination yet, I was wondering what the best approach to take would be.

andrewjroberts's avatar
andrewjroberts's avatar ratiw10yrs agoVue
5
1
Last reply by ratiw 10yrs ago
shd's avatar

Pagination from a user-selected form on a view

Hi, I have a form on a view page that I would like to have control over the number of items that are returned by the paginator. What is the best way to achieve this? For this example I have two controllers and related Eloquent models for Clients and News. Each client can only have their own news articles returned. At the moment, I am storing the number of pagination items in th

shd's avatar
shd's avatar Kryptonit311yrs agoLaravel
3
1
Last reply by Kryptonit3 11yrs ago
vtxmg's avatar

Pagination Problem Again :D

I did this for two pagination on same page as @pmall said. Yes it set the page name but didn't work in real. In my controller: $paginator1 = Model1::where(...)->paginate(); $paginator2 = Model1::where(...)->paginate(); $paginator1->setPageName('foo'); $paginator2->setPageName('bar'); In view: {!! str_replace('/?', '?', $paginator1 ->appends(Request::input())-&g

vtxmg's avatar
vtxmg's avatar pmall11yrs agoEloquent
4
1
Last reply by pmall 11yrs 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.