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

midascodebreaker's avatar

Jeffrey way How did you do the pagination in Laracast?

Hi Jeff, I wonder how can i achieve the same pagination you used in laracast... i have this problem where pagination looks aweful when i render it in my view... it looks like this < 1 2 3 4 5 6 7 8 9 ... 13 14 15 > It break on the next line on mobile devices... I already posted here once about this, but no one knows how to make it retrieve a finite amount of page link

midascodebreaker's avatar
midascodebreaker's avatar midascodeb...10yrs agoLaravel
0
1
sameermalikrp's avatar

Custom Pagination

I'm using meterializecss as a css framework and i wanted to make a pagination please tell me how can i make my own paginator in laravel 5.2

sameermalikrp's avatar
sameermalikrp's avatar supervip10yrs agoLaravel
1
1
Last reply by supervip 10yrs ago
Mirdrack's avatar

Pagination or Simple Pagination

I understand that I should use simple pagination if i have a large dataset but somebody could please tell me if there is a way to determinate when is large enough to apply simple pagination For example on the near future I'm gonna have to handle a table with 40K of records, I'm gonna use simple pagination but... should I use it or just I'm overreacting Thanks in advance

Mirdrack's avatar
Mirdrack's avatar JoeDawson10yrs agoLaravel
1
1
Last reply by JoeDawson 10yrs ago
midascodebreaker's avatar

How can i Limit the Number of Return Pagination Page?

I have no Problem Rendering my Custom Pagination, But I wanna Limit the Number of Pages Link to be Shown for example < 1 2 3 4 5 6 ... 999> Since When you Use paginate method it automatically returns you a set of methods and an object that has all the necessary info you need to render a pagination I Wanted to make the View for user be more Natural Coz if i have to Many P

midascodebreaker's avatar
midascodebreaker's avatar midascodeb...10yrs agoLaravel
0
1
rolandas's avatar

Pagination and post checking

I got code below: <div class="box blog"> @foreach($blogPosts as $blogPost) <?php $officialDate = strtotime(date('Y-m-d')); $dateActiveFrom = strtotime($blogPost['public_from']); $dateActiveTo = strtotime($blogPost

rolandas's avatar
rolandas's avatar rolandas10yrs agoLaravel
0
1
midascodebreaker's avatar

Need Help in Pagination on Lesson Dedicated Query String Filtering

Hi Ive Followed Jeff Lesson, but i did more than he did such as filtering many to many relationship Product BelongsToMany Category and Category BelongsToMany Product $products = Product::filter($filters)->published()->distinct()->get(['id', 'name', 'description', 'caption', 'price', 'image', 'slug', 'sku', 'thumbnail', 'options', 'rating_cache', 'rating_count', 'views'

midascodebreaker's avatar
midascodebreaker's avatar supervip10yrs agoLaravel
2
1
Last reply by supervip 10yrs ago
danny620's avatar

Custom Pagination

I'm using a custom markup for pagination how can I control laravel default wrappers Pagination --> 1 2 3 <nav class="pagination-next-prev"> <ul> <

danny620's avatar
danny620's avatar martinbean10yrs agoCode Review
1
1
Last reply by martinbean 10yrs ago
Khudadad's avatar

Problem with Laravel Pagination

Hi, I'm using laravel 5.2 and I want to replace laravel automatic pagination via ajax response data and don't know, any help. this is default pagination {!! $staffs->render() !!} and I want to replace it with ajax response data

Khudadad's avatar
Khudadad's avatar bestmomo10yrs agoLaravel
2
1
Last reply by bestmomo 10yrs ago
Jaytee's avatar

Pagination Display

@JeffreyWay Not a big deal but thought i'd let you know: White background behind pagination. https://gyazo.com/3694700084b9df2624ad177a24a60c11 Windows 10: Chrome: 49.0.2623.110 m Desktop PC, Resolution: 1920x1080

Jaytee's avatar
Jaytee's avatar DPJack10yrs agoFeedback
2
1
Last reply by DPJack 10yrs ago
calicastle's avatar

Pagination Not Working

When I'm testing my application in local environment, the pagination worked. But once I deployed it up to the server, and I visited it with ?page=2, it didn't skip the first page, instead the list result is still the first page's. I died and dumped the $users variable and it seems like it got stuck on page 1, but the lastPage is 2 and I just can't visit page 2 for whatever reas

calicastle's avatar
calicastle's avatar DPJack10yrs agoEloquent
3
1
Last reply by DPJack 10yrs ago
kvlknctk's avatar

Eloquent with pagination / count relationship table

my model like this public function mostAnswer() { $quests = Questin::with("question", "answer") ->get() ->sortBy(function ($banswer) { return $banswer->answer(); })->reverse() ->take(10); return view('homepage', ['quests' => $quests]); } its working but

kvlknctk's avatar
kvlknctk's avatar kvlknctk10yrs agoEloquent
2
1
Last reply by kvlknctk 10yrs ago
abusalameh's avatar

Pagination via VueJS

Hello guys, I'm having a problem with making a pagination using Laravel 5.2 & VueJS the problem is that I added a " Computed Property " that calculates the totalPages the problem is that this property gets zero value because the ajax request is too late !

abusalameh's avatar
abusalameh's avatar qahmad10yrs agoVue
7
1
Last reply by qahmad 10yrs ago
jbowman99's avatar

Pagination Problems, using Query Builder results

Pagination is currently working on my index page, but when you search for an Item, and return results with pagination, the pagination breaks. postSearch Method looks like this: public function postSearchItems(ItemSearchRequest $request, $limit = 5) { if (\Request::has('itemID')) { // Since the item search select can only accommodate the ItemID but we wan

jbowman99's avatar
jbowman99's avatar premsaurav10yrs agoLaravel
18
1
Last reply by premsaurav 10yrs ago
mushu8's avatar

Optimisation of Pagination for api

Hi, i'm developing an api with Laravel and DingoAPI which returns the message threads of the user with pagination. $threads = Thread::forUser($currentUserId)->latest('updated_at') ->simplePaginate(1); return API::response()->array($threads); and i get this kind of response : { "per_page": 1, "current_page": 1, "next_page_

mushu8's avatar
mushu8's avatar andremello...10yrs agoLaravel
8
1
Last reply by andremellow 10yrs ago
sameermalikrp's avatar

Pagination error_Method App\Http\Controllers\WorkerController::worker() does not exist

Error found on pagination 1)works fine for the first page other than that if I select 2,3,4.... page it shows " ReflectionException in Route.php line 264: Method App\Http\Controllers\WorkerController::worker() does not exist " and the field value(in this case search string erases on every page load) function search(Request $request) { $input=$request->o

sameermalikrp's avatar
sameermalikrp's avatar sameermali...10yrs agoLaravel
0
1
Birdy's avatar

If page pagination is greater than..

Hi, Im using the built in simple pagination with custom css. As you are probably aware, Laravel appends the pagation page ids to the url when using pagination, However if some malicious user as such wants to try and get technical, Lets say we have the following setup: http://example.com/article and now we have added 3 pages of pagination http://example.com/article?page=1 http:/

Birdy's avatar
Birdy's avatar aliyasir6yrs agoLaravel
6
2
Last reply by aliyasir 6yrs ago
Suganya's avatar

Custom data pagination with Laravel 5 using an array from controller

I'm having a function in the controller, it return the results while doing post action.. And it return an array while done post action to the view file In view @foreach($results as $res) <?php //display contents echo $res->name; echo $res->price; ?> @endforeach In controller $this->data['results'] =!empty($aReslts) ? $aReslts : ''; $this->data['i

Suganya's avatar
Suganya's avatar Suganya10yrs agoLaravel
0
1
eddy1992's avatar

Pagination problem

Hi I have appended query string in the url which looks like this localhost:8000/catalog?brand_id[]=5&brand_id[]=10&brand_id[]=1 Now my Model that is creating the pagination is $products = Product::whereHas('brands', function($query) use ($brandIds) { $query->whereIn('brand_id', $brandIds);

eddy1992's avatar
eddy1992's avatar bbojan8310yrs agoEloquent
2
1
Last reply by bbojan83 10yrs ago
lsutiger's avatar

Child Relationship Pagination

I have my models set up and am able to return parent/child relationships between two tables; quotes and authors. I am wanting to query the authors table and return the paginated results of any related quotes associated with each author for use in a view. In my current situation, I am returning one author and their related quotes but I cannot seem to get a handle on the pagina

lsutiger's avatar
lsutiger's avatar lsutiger10yrs agoEloquent
7
1
Last reply by lsutiger 10yrs ago
franckie's avatar

Pagination appending not working

Hi, The previous and next links are working but not the numbered links eg. of a numbered link http://domain.com/?page=2 eg. of next link http://domain.com/?day_filter%5B0%5D=1&page=2 I am filtering search results with a form with checkbox like this .... Here is blade code {!! (new App\Pagination($shifts))->appends(Request::except(['_token','csrf_token']))-&

franckie's avatar
franckie's avatar franckie10yrs agoCode Review
0
1
badQuetions's avatar

VueJs how to make pagination with limiter and range..??

how to make pagination with limiter and range in vueJs..?? I have code like this : http://jsfiddle.net/badvz/fp9kpn9q/1/ Im stuck trying to create a pager with vuejs, Im lost, so far I got to reproduce a simple pager with some examples out there, but is not functional on a table with 5k rows or more, too many pages , so I was wonder if anyone can appoint an example of how to ma

badQuetions's avatar
badQuetions's avatar almino9yrs agoVue
6
1
Last reply by almino 9yrs ago
eddy1992's avatar

how to remove ? from pagination

Hi I want to remove and replace the ? from the pagination $products = Product::whereHas('categories', function($query) use ($categoryIds) { $query->whereIn('category_id', $categoryIds); })->paginate(16)->setPath($this->getCategoryId().'?level='.Input::get('level')); now what it gives is http://localhost:8000/category/24?level=parent?pa

eddy1992's avatar
eddy1992's avatar martinbean10yrs agoLaravel
3
1
Last reply by martinbean 10yrs ago
xitec's avatar

Subquery with Eloquent and pagination

Hello, I have a MySQL database table with a large number of rows. I noticed that the ORDER BY clause is heavily slowing down the query. A nice solution for this is to wrap the query inside a subquery to make it run much faster. In plain MySQL, my query will be: SELECT * FROM (SELECT products.id, categories.name FROM products INNER JOIN categories ON products.category_

xitec's avatar
xitec's avatar DJChavez3yrs agoEloquent
8
1
Last reply by DJChavez 3yrs ago
Slothlike's avatar

Pagination and the BootstrapFourPresenter

Hello, This is my very first post to the forum. I'm very new to Laravel and still learning. I've been playing around with pagination. In Illuminate\Pagination\LengthAwarePaginator.php there's a render method which uses BootstrapThreePresenter. I've discovered a BootstrapFourPresenter there. What's the best way to implement the BootsrapFourPresenter in my project for all of my

Slothlike's avatar
Slothlike's avatar usman10yrs agoEloquent
3
1
Last reply by usman 10yrs ago
therons's avatar

pagination page # for specific record by ID?

Hi Everyone, After inserting a company a record. I would like to retrieve the paginated page where the newly created is sitting. After the record is successfully inserted I redirect to a view that has a paginated list of companies that are sorted in alphabetical order. So basically I'd like to look within the pagination collection for the company id of x and have it return the

therons's avatar
therons's avatar therons10yrs agoEloquent
10
1
Last reply by therons 10yrs ago
eddy1992's avatar

Pagination and ajax

Hi I am making an e commerce website and I have filter in my front end. There are two types of filters to filter products : By brands By price Now what I am doing right now is that when a user clicks on the brands filter check box an ajax call is fired and I fetch the brand ids and then I find all the products related to the brand ids. my jquery ajax (Sorry I am very new wit

eddy1992's avatar
eddy1992's avatar ZetecVan10yrs agoLaravel
2
1
Last reply by ZetecVan 10yrs ago
3ay4ka's avatar

Multiple pagination with Laravel (2 pagination in 1 page)

I have a view page with 2 paginations. I've found the solution to change pagename ->paginate(2)->setPageName('page'); ->paginate(3)->setPageName('opage'); but the second pagination is in the first here is example: @foreach($comments as $comment) comment output @foreach($reply as $rep) @if($comment->id == $rep->parent_id) replay output @endif @endforeach here i

3ay4ka's avatar
3ay4ka's avatar 3ay4ka10yrs agoLaravel
0
1
jrowe's avatar

Laravel + Vuejs with pagination ( updated/loaded via ajax ) for data loaded from Laravel models.

Laravel + Vuejs with pagination ( updated/loaded via ajax ) for data loaded from Laravel models. This would be a great (set?) tutorial. I can load object's in Vue's data: with Model::all() but do not know how to make it so only a partial set can show and can be paginated via vuejs + ajax. More Vuejs + laravel videos in general would be nice like how data from laravel is consume

jrowe's avatar
jrowe's avatar jrowe10yrs agoRequests
0
1
sanakran's avatar

Generate own link instead of pagination render default link - laravel 5.0

Developed one new laravel 5.0 app. There I have used ajax concept for every pages. Each and every request and response will travel through ajax. Main Page: <onclick="view('bydproject')">View ByDProject Data <> (inside li tage) < id='main'> (Inside div tag) Ajax call : function view(url) { fullurl = "http://localhost:8000/" + ur

sanakran's avatar
sanakran's avatar jekinney10yrs agoLaravel
6
1
Last reply by jekinney 10yrs ago
bottelet's avatar

Laravel Ajax pagination

I'm following a guide on how to make the pagination called with Ajax, but i', having a little trouble 3 problems one: It first shows up after i click, on one of the links() in the pagination The pagination's links() dosn't move it's just on one. the style in the table are not correct at all, but im gusseing that cause it comes inside the tag I'm using to call it Here are my c

bottelet's avatar
bottelet's avatar cawex10yrs agoCode Review
9
2
Last reply by cawex 10yrs ago
Tominator's avatar

Pagination with a maximum limit

Hi, I'm trying to create a "recent products" page, with a paginator. My naive attempt is Product::(somefilters)->paginate(10); This works well, as in it paginates nicely in the view. However, it takes all products in my database that match the filters. For my "recently added" section, I'd like to return a maximum of 100 products, not however many were cre

Tominator's avatar
Tominator's avatar Tominator10yrs agoEloquent
2
1
Last reply by Tominator 10yrs ago
bottelet's avatar

Laravel 5.2 pagination

I've been trying to create a pagination, that list 10 task on each page, but on the the user page where tasks are assigned to the user, but i keep getting this error: ErrorException in Builder.php line 2161: Call to undefined method Illuminate\Database\Query\Builder::links() I've tried the following: Controller public function show($id) { $user = User::with('t

bottelet's avatar
bottelet's avatar cawex10yrs agoEloquent
2
1
Last reply by cawex 10yrs ago
Dracool's avatar

Pagination + query results (not working as intended)

I have 15 posts in my blogposts database and I want laravel to show 5 of them on page (would take 3 pages) in total. But both the query and pagination don't work. For some reason, the query returns only 4 items and the pagination doesn't work at all (even though pagination cuts the items selected when I specify how many) $data = DB::table('blogposts') ->select('*')

Dracool's avatar
Dracool's avatar ben_s24710yrs agoGeneral
16
1
Last reply by ben_s247 10yrs ago
depsimon's avatar

Vue and Laravel Pagination

Hey guys, I have these Pages that I can manage in my back-end. So I made a template with the paginated Pages using Laravel Pagination. It all worked fine, but I wanted to manage that view with Vue.js Here's how I implemented this, the difficulty was to rebuild the pagination links. In my case I wanted it like this : "< 1 2 ... 4 5 6 ... 9 10 >" (pretty much like

depsimon's avatar
depsimon's avatar depsimon10yrs agoCode Review
0
1
lehel's avatar

Laravel 5.0 custom pagination

Hi, I tried to use a custom pagination of a collection in Laravel 5.0 . $items = new \Illuminate\Pagination\Paginator($items, 7); $items->setPath(route('getHome'); I have a problem. On every page i get back the same 7 $items infinitly. How could i resolve this problem? Somebody used a custom Paginator in Laravel 5.0 ?

lehel's avatar
lehel's avatar jlrdw10yrs agoLaravel
1
1
Last reply by jlrdw 10yrs ago
midascodebreaker's avatar

Customize pagination {!! $var->links() !!}

How Can i Create a Custom Pagination and use my own html and css for pagination coz if i just use the helper method i dont know how to change the pagination html and css thanks

midascodebreaker's avatar
midascodebreaker's avatar RoboRobok10yrs agoLaravel
1
1
Last reply by RoboRobok 10yrs ago
djangokillen's avatar

Custom pagination redirects back to same page

Hi! I'm trying to make custom pagination on a normal collection, but it doesn't seem to be working very well. When I click on the next page I get redirected to the first. All the time. This is where I display the paginated results: @foreach ($uniqueArticles->chunk(6) as $set) <div class="row"> @foreach ($set as $article)

djangokillen's avatar
djangokillen's avatar djangokill...10yrs agoLaravel
0
1
abusalameh's avatar

Pagination problem

Hi all, I used laravel pagination .. and it was working 100% ... I didn't change anything in the code .. The generated links are correct ... But when I choose next page or page number .. It doesn't change the content of the current page ....!!! Ex: ... Controller GetUsers method $users = User::paginate(10); return view('users.index',compact('users'); ........ Index view @foreac

abusalameh's avatar
abusalameh's avatar Snapey10yrs agoLaravel
6
1
Last reply by Snapey 10yrs ago
vk011's avatar

Laravel 4 pagination links ignore existing GET parameters

Hello, I have a search in Laravel 4. After search for sh my url is this: http://localhost/musiter/product/search-products/24?query=sh I also have pagination there, but the pagination for the second link for example is: http://localhost/musiter/product/search-products/24?page=2 instead of: http://localhost/musiter/product/search-products/24?query=sh&page=2 Any way to fix th

vk011's avatar
vk011's avatar vk01110yrs agoLaravel
1
1
Last reply by vk011 10yrs ago
GiacomoM's avatar

Pagination in One To Many relationship

Hi, I have a model with an One To Many relationship, and I need to get 1 record of the main model with the pagination of the records of the relationships. How can I do that? Thanks

GiacomoM's avatar
GiacomoM's avatar GiacomoM10yrs agoEloquent
3
1
Last reply by GiacomoM 10yrs ago
SergioGregorutti's avatar

Laravel pagination: Change page parameter name

Hi all, I want to make a simple change on the Laravel pagination. By default I get a "?page=x" URI but I need this: "?pag=x". How can I make this change? I read the documentation and I found this: Customizing The Paginator URI The setPath method allows you to customize the URI used by the paginator when generating links. For example, if you want the paginat

SergioGregorutti's avatar
SergioGregorutti's avatar SergioGreg...10yrs agoLaravel
2
2
Last reply by SergioGregorutti 10yrs ago
londoh's avatar

Issue with pagination

@JeffreyWay - A Happy New Year to you. It looks like there's an issue with pagination. There's a long running thread titled "Where are you all from". Somebody just posted and at this time the "Updated" link goes to page 18: https://laracasts.com/discuss/channels/general-discussion/where-are-you-all-from?page=18 But page 18 doesnt exist and the last post is o

londoh's avatar
londoh's avatar DPJack10yrs agoFeedback
4
1
Last reply by DPJack 10yrs ago
IsaacBen's avatar

Pagination count validation

So I'm simply trying to let the user know if search results are empty, but if they aren't then there might be a pagination. On the second page of pagination I get undefined $ticket variable. How should I fix this? @if(!$ticket->count()) <h1>No results were found, please make sure you typed the input correctly.</h1> @else //Show results {!! $ticket->appends

IsaacBen's avatar
IsaacBen's avatar IsaacBen10yrs agoLaravel
2
1
Last reply by IsaacBen 10yrs ago
ivanhalen's avatar

Count from/to records in pagination

Hello, When using pagination I an easily show the total records: Total Records: {{ $results->total() }} But what if I want to show something like this? Records 1-10 of {{ $results->total() }} (for page 1) Records 11-20 of {{ $results->total() }} (for page 2) Records 21-30 of {{ $results->total() }} (for page 3, and so on) etc.? Thanks

ivanhalen's avatar
ivanhalen's avatar ivanhalen10yrs agoEloquent
5
1
Last reply by ivanhalen 10yrs ago
alpha's avatar

How to avoid [Disqus] Discussion duplication when using Pagination?

hello guys, I am having problem with Disqus + laravel pagination. I have a post model where a post have minipost and for each post i want it to contain 5 minipost.. when I navigate to the 2nd pagination page the Disqus Discussion got auto generated for the 2nd page.. How can I avoid this duplication? <div id="disqus_thread"></div> <script> var di

alpha's avatar
alpha's avatar alpha10yrs agoLaravel
2
4
Last reply by alpha 10yrs ago
George12's avatar

Return pagination in array

I need to return a json with all products and stores. I tried this $products = $products->paginate(20); $stores=$this->getStores(); return ['product'=> $products, 'stores' =>$stores]; and this return Response::json( array( 'products' => $products, 'stores' => $stores, ), 200 ); but $products returns empty. (If i run "dd($products)" i ca

George12's avatar
George12's avatar thomaskim10yrs agoEloquent
5
1
Last reply by thomaskim 10yrs ago
mistery_girl's avatar

Route for search pagination

Hello! I'm using Laravel 5. I'm trying to make a route for pagination results from a search. My url when there is pagination is like this: myproject/search?q=something/page/2 My routes are: Route::get('/search',['uses' => 'SearchController@index','as' => 'search']);``` First route throws `NotFoundHttpException`. Second is fine. My form is: ``` {!!Form::open(['url' =>

mistery_girl's avatar
mistery_girl's avatar mistery_gi...10yrs agoRequests
24
1
Last reply by mistery_girl 10yrs ago
Ranjeet's avatar

Decreasing Length of Pagination

I want to make pagination like laracasts.com. if i have 100 records then if i display 10 records per page than i want to show pagination links like this1, 2,3....7,8,9 ..next button and son on. pubic function getRecords() { $records = \DB::table('cases)->paginate(10); } in view {!!str_replace('/?','?',$records->render())!!} This give pagination like this1,2,3,4,5,6,7,

Ranjeet's avatar
Ranjeet's avatar Ranjeet10yrs agoCode Review
0
1
mlusas's avatar

Updating Pagination Documentation?

The Laravel 5.1 documentation for Pagination seems to be out of date, with methods that are no longer available (ex., paginate()), and new methods that seem to have taken it's place (ex., limit()->skip()->get()). Are there plans to update the documentation in the near future? I've already pivoted to the new pagination methods (using limit()->skip()->get()), but tho

mlusas's avatar
mlusas's avatar mlusas10yrs agoLaravel
3
1
Last reply by mlusas 10yrs ago
Muzammil's avatar

L5 Cache with Pagination

Hi floks, i'm trying to implement cache db query with pagination , but it only shows first cached set of data no matter on which page you are. Below is what i have done so far: $allProducts = Cache::remember('allProducts','30',function(){ return Products::orderby('name','ASC')->paginate(15); }); return view('manage-products',['products'

Muzammil's avatar
Muzammil's avatar Muzammil10yrs agoLaravel
2
1
Last reply by Muzammil 10yrs 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.