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

TuffRivers's avatar

Best way to implement "download" reports feature with pagination

Hi All, I have a basic CRUD app that has a reporting page allowing users to splice data and print reports based on basic filters (date, customer, transaction type). My database handles filtering/pagination/search. Pagination needed as browser could be tasked to load 5000-6000 records for a single client if required by user. What is best way to implement a "Download" f

TuffRivers's avatar
TuffRivers's avatar lostdreame...8yrs agoGeneral
3
1
Last reply by lostdreamer_nl 8yrs ago
Jacobs's avatar

Change value inside pagination data

Hey, I need to cycle through pagination data and change a value based on a condition, but I'm getting this error: Type error: Argument 1 passed to Illuminate\Database\Grammar::columnize() must be of the type array, string given HouseController: <?php namespace App\Http\Controllers; use Illuminate\Pagination\Paginator; use Illuminate\Support\Facades\Cache; use Illuminate\Su

Jacobs's avatar
Jacobs's avatar Jacobs8yrs agoEloquent
1
1
Last reply by Jacobs 8yrs ago
mehdithemaker's avatar

Pagination MethodNotAllowedHttpException problem

Hello I have 2 views one that make me made a searsh to get the data from db and one that show me that data when I have set pagination with $myobject->links() it's not working and it giving me an error MethodNotAllowedHttpException I have already tryed all solutions on internet it's not working I have opened a question in stackoverflow https://stackoverflow.com/questions/5044

mehdithemaker's avatar
mehdithemaker's avatar Cronix8yrs agoLaravel
1
1
Last reply by Cronix 8yrs ago
adamjhn's avatar

Do you know why the pagination links are not appearing?

I have this index() method below that gets the draft congresses, that is congresses where status column has the value "D". Then in the view I have "{{$draftCongresses->links()}}" but the pagination is not appearing. Do you know where can be the issue? public function index(Request $request){ $pageLimit = 5; $user = $request->user();

adamjhn's avatar
adamjhn's avatar skoobi8yrs agoLaravel
5
1
Last reply by skoobi 8yrs ago
adamjhn's avatar

How to achieve a pagination for this scenario?

I have a UserController that has the index() method that get all congresses organzied by a user with "$congresses = $user->congresses()->get();". Then in the view I show, for example the draftCongresses, like: @foreach($congresses->filter(function ($item) { return $item->draftCongresses(); }) as $congress) <li class="list-group-item">

adamjhn's avatar
adamjhn's avatar jlrdw8yrs agoLaravel
3
1
Last reply by jlrdw 8yrs ago
Cronix's avatar

Pagination bug when clicking on time link

Kind of tricky to explain. When on a thread list/index page (like "all threads"), and you click on the time link of a thread ("1 minute ago", etc), and the last page of the actual posts contains 15 posts, it sends you to the next page, where there is nothing. Let's say a thread has 15 posts, which seems to be what the pagination is set for. That's 1 page. If

Cronix's avatar
Cronix's avatar londoh8yrs agoFeedback
4
1
Last reply by londoh 8yrs ago
uchihaabhi's avatar

Laravel pagination using ajax while page load and filtering

I am building a simple database call which paginates the data and displays. But there is also a radio button which on checking fires an ajax and diplays data. I want to paginate that filtered data as well. Sorry could not use code snippet here Below is my code. $(function() { $('body').on('click', '.pagination a', function(e) { e.preventDefault(); $("#divLoading").add

uchihaabhi's avatar
uchihaabhi's avatar uchihaabhi8yrs agoLaravel
0
1
ralphmorris's avatar

Query two different models and merging with pagination

I have two Models Conversation and DirectEnquiry that I would like to query together and show in the same list of results with pagination. This is where I am at: $conversations = $user->conversations() ->inbox($filters) ->with('job') ->paginate(20); $dire

ralphmorris's avatar
ralphmorris's avatar ralphmorri...8yrs agoEloquent
4
1
Last reply by ralphmorris 8yrs ago
oroalej's avatar

Union with pagination - Laravel 5.6

Hi Guys, How can I add pagination on a union. I got an error Cardinality Violationwhen using union with ->paginate().

oroalej's avatar
oroalej's avatar jlrdw8yrs agoEloquent
11
1
Last reply by jlrdw 8yrs ago
karelmares's avatar

List of products with pagination handled by vuejs and SEO impact

Hi guys. I am curious about how to build the list of entities with pagination and filtering with vuejs (instead of jquery) in my laravel application. I worrying about the bad impact on SEO when using vuejs. It is good practice to render the list of entities inside the noscript tag in blade template for search bots and then render another list with vuejs for users? Or is there a

karelmares's avatar
karelmares's avatar karelmares8yrs agoLaravel
2
1
Last reply by karelmares 8yrs ago
grindwebstudio's avatar

How to add pagination meta when combining Collection with Resource in API Resource

Hi there all ! Building a API in here and using the new API Resource options. However I need this to work: $users = User::paginate(10); return new UserCollection(UserResource::collection($users)); This will not include any meta or links data for that pagination. However if I run: $users = User::paginate(10); return new UserCollection($users); It does include meta data for the p

grindwebstudio's avatar
grindwebstudio's avatar DShannon7yrs agoLaravel
4
1
Last reply by DShannon 7yrs ago
siusiak1000's avatar

Pagination doesn't works

I have: $produkty_po_subkategorii = MagazineSubcategory::withCount('products')->where('name', $subkategoria)->orderBy('id', 'desc')->paginate(3); ; Pagination does not react. It still displays all products by subcategory on one page.

siusiak1000's avatar
siusiak1000's avatar siusiak100...8yrs agoLaravel
43
7
Last reply by siusiak1000 8yrs ago
thebigk's avatar

Caching results breaks pagination

I've Redis cache configured and it's awesome. The only problem I'm facing is that pagination fails when using the following code - $articles = Cache::store('redis')->remember('articles', 1, function() { return Article::where('active', 1)->latest()->paginate(5); }); The pagination links are rendered using {{$articles->render()}}. The problem is i

thebigk's avatar
thebigk's avatar bobbybouwm...8yrs agoEloquent
1
1
Last reply by bobbybouwmann 8yrs ago
DeftNerd's avatar

How to integrate signedRoutes with Pagination?

There doesn't seem to be a native way to create pagination links that support signed routes. I've tried creating a custom pagination template, but have run into problems because signedRoutes only works with named routes and not raw URL's, and the pagination functions only output URLs. Anyone tackle this problem and find a solution yet?

DeftNerd's avatar
DeftNerd's avatar DeftNerd8yrs agoLaravel
0
1
AquinoBR's avatar

How to condition pagination

Below is the one page code that lists some data, however I made a condition to only sample one type in that listing, but in the page it counts all the data in the table in mysql. I want to know how the pagination shows only the data for this condition on that page. @section('content') <div class="content"> @include('admin.includes.alerts') <

AquinoBR's avatar
AquinoBR's avatar AquinoBR8yrs agoLaravel
2
1
Last reply by AquinoBR 8yrs ago
vandyczech's avatar

Pagination array

I have this array and I want make a pagination this. This array has 14 items. LengthAwarePaginator {#574 ▼ #total: 14 #lastPage: 3 #items: Collection {#575 ▼ #items: array:14 [▼ 0 => array:2 [▼ "name" => "photo" "url" => "/photo" ] 1 => array:2 [▶] 2 => array:2 [▶] 3 => array:2 [▶] 4 => array

vandyczech's avatar
vandyczech's avatar rin4ik8yrs agoLaravel
6
1
Last reply by rin4ik 8yrs ago
Azoruk's avatar

Duplicate results in endless pagination when new entries added to ajax query

On my website, users can post images. When a user browses images, if he scrolls down to the bottom of the page, new images (7 in total) will be fetched. JS: $(window).scroll(fetchImages); function fetchImages() { var page = $('.endless-pagination').data('next-page'); if(page !== null) { clearTimeout( $.data( this, "scrollCheck" ) ); $.data

Azoruk's avatar
Azoruk's avatar biishmar8yrs agoJavaScript
2
1
Last reply by biishmar 8yrs ago
UAVova's avatar

ResourceCollection doesn't include pagination links.

CommentsCollection class CommentsCollection extends ResourceCollection { public function toArray($request) { return [ 'data' => $this->collection ]; } } CommentsController public function index() { $post = Post::find(1); return ['post'=> $post, 'comments' => new CommentsCollection(Comment::paginate(1))]; } Response &

UAVova's avatar
UAVova's avatar UAVova8yrs agoLaravel
0
1
Kareimovich's avatar

laravel pagination get first page

Hi, everybody, I need to add First-page url like my last page Wehn i use firstItem i don't get full url @if ($paginator->hasPages()) <ul class="pagination"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) <li class="disabled"><span>&laquo;</span></li> @else &

Kareimovich's avatar
Kareimovich's avatar DivPro8yrs agoEloquent
8
1
Last reply by DivPro 8yrs ago
sibarra's avatar

Laravel 5.3 pagination not retaining the current URL

Pagination not working properly, i am on below page http://localhost.test/students/list when i click on second page it is redirecting to the http://localhost.test/?page=2 Not retaining actual url, it should redirect me to - http://localhost.test/students/list?page=2 any idea whats going wrong?

sibarra's avatar
sibarra's avatar Snapey8yrs agoGeneral
2
2
Last reply by Snapey 8yrs ago
jestins's avatar

Pagination issue in Laravel 5.3

When I try to render pagination getting this error. ErrorException in AbstractPaginator.php line 377: call_user_func() expects parameter 1 to be a valid callback, no array or string given (View: C:\xampp\htdocs\project\resources\views\pages\app\file.blade.php) (View: C:\xampp\htdocs\project\resources\views\pages\app\file.blade.php) (View: C:\xampp\htdocs\project\resources\view

jestins's avatar
jestins's avatar jestins8yrs agoLaravel
1
1
Last reply by jestins 8yrs ago
taishi's avatar

Laravel Pagination has

Hello guys, I am having a problem with the generated pagination. The pagination links are having ellipsis(...) and after those ellipsis, the page numbers seem to be showing the last 2 link pages of the pagination. So the generated page links looks like this; < | 1 | 2 | 3 | ... | 20 | 22 | > Here is my code for the database paginating. public function scopeBlogs($query,

taishi's avatar
taishi's avatar taishi8yrs agoLaravel
13
1
Last reply by taishi 8yrs ago
oroalej's avatar

Pagination without ...

I would like to create a pagination only 1 2 3 4 5 6 7 8. However, when the page is more than 10, the pagination becomes 1 2 3 4 5 6 7 8 ... 9 10. How can i remove the ... 9 10? Is there a way to do this?

oroalej's avatar
oroalej's avatar Snapey8yrs agoLaravel
1
1
Last reply by Snapey 8yrs ago
aperezmi's avatar

Pagination with a hasMany relationship

Hello everyone, I have an issue related to pagination when you have a hasMany relationship. Let's say we have an 'authors' table, and each Author has many 'books'. Using a form, I filter on different properties of the authors, e.g. 'country'. Each author of this query has many books, and I want to paginate the books with one book per page, so I have something like: -First 10 p

aperezmi's avatar
aperezmi's avatar bobbybouwm...8yrs agoLaravel
1
1
Last reply by bobbybouwmann 8yrs ago
Kareimovich's avatar

Anime Episode pagination

I want to reverse the Episode order of each Anime post. Also apply pagination to it. Please Help. public function index() { $animes = Anime::paginate(2); return view('welcome',compact('animes')); } public function view(anime $anime) { return view('show', compact('anime')); } @extends ('layouts.animes') @section ('content') <section class="jumbotron text-

Kareimovich's avatar
Kareimovich's avatar lostdreame...8yrs agoLaravel
1
1
Last reply by lostdreamer_nl 8yrs ago
absolute's avatar

Pagination of GROUPED query results within Laravel 4.2

I have a query which currently returns in the region of 25k records, with this likely to exceed 100k by the end of year. Obviously this is paginated for readability..... Having delved into the code for pagination, it appears that the standard Laravel 4.2 code returns the entire dataset in order to get the TOTAL count, and then slices the resulting collection in order to return

absolute's avatar
absolute's avatar absolute8yrs agoLaravel
0
2
alihuseyin's avatar

laravel ajax pagination

Hello, I dont know much about ajax, just started today. I tried this example https://hdtuto.com/article/laravel-55-ajax-pagination-example and it works fine but i want to a fixed url that does not include pagination numbers. eg: mysite.com/categories?page=4 // i dont want this mysite.com/categories // i want this Can you suggest me any way or tutorial?

alihuseyin's avatar
alihuseyin's avatar m-rk8yrs agoLaravel
5
1
Last reply by m-rk 8yrs ago
rajesha's avatar

Laravel pagination with search function

Hi, any one please help me out, how we can pagination with search function.

rajesha's avatar
rajesha's avatar charlygiro...6yrs agoLaravel
6
1
Last reply by charlygirola 6yrs ago
khawarraza's avatar

Pagination not working

I am trying to fetch few records from DB and applying pagination on results but pagination seems not to be working. Here is my code snippet: Class City { public function ads() { return $this->hasManyThrough('Sello\Ad', 'Sello\User'); } } public function getAdsFeedWithFilters(Request $request) { // fetch request params $ads = $city->load(['ads' => funct

khawarraza's avatar
khawarraza's avatar Snapey8yrs agoEloquent
6
1
Last reply by Snapey 8yrs ago
alrus2797's avatar

Point type format in pagination

Hi, I used laravel pagination to show jobs with a geolocation datatype based on tags. Usually, when I do a paginate directly to the Jobs Model (without Tags) it give me objects with the location column in a correct format ("location" => "POINT(-16.405171 -71.4833536)") But I need a function to search jobs based on tags (There's a many to many relationship

alrus2797's avatar
alrus2797's avatar alrus27978yrs agoLaravel
0
1
likvidatorTM's avatar

Pagination with dinamic data.

Hi, recently i used eloquent simple pagination but now i found some critical bug (eloquent method works fine, bug in my solution=)). In query i am use some conditions like if order active, if user can see this order end etc. When user gets next page results can be displaced and he gots incorrect data. For example: user loads first page with 10 orders then he loads second page

likvidatorTM's avatar
likvidatorTM's avatar likvidator...8yrs agoLaravel
6
1
Last reply by likvidatorTM 8yrs ago
tristanisginger's avatar

Using Javascript to add class to pagination

Hello Everybody, I need to add two classes to the ul element of a pagination object (no-margin pagination-sm) I can easily accomplish this with JS however is this the preferred method?

tristanisginger's avatar
tristanisginger's avatar tristanisg...8yrs agoTips
2
1
Last reply by tristanisginger 8yrs ago
mstdmstd's avatar

Pagination implementation in laravel 5.5/vue.js app

Hello, I search for pagination implementation in laravel 5.5/vue.js app on mysql-based data. I googled and tried some examples : but they were did not workable or to complicated for me. If possible with live demo or tutorial ... Thanks!

mstdmstd's avatar
mstdmstd's avatar SyedAbutha...8yrs agoVue
4
1
Last reply by SyedAbuthahir 8yrs ago
HFH's avatar

Laravel 5.5 & Bootstrap 4 Pagination Issues

I've seen a number of threads regarding the class changes in pagination from BS3 to BS4, but I can't seem to get to the bottom of it on my own app. Using a simple pagination in my controller with: $users = DB::table('users')->orderBy('created_at', 'desc')->simplePaginate(5); And then rendering the pagination buttons as such: {{ $users->render() }} Gives me unstyled l

HFH's avatar
HFH's avatar pardeepkum...7yrs agoGeneral
7
1
Last reply by pardeepkumar 7yrs ago
Rainieren's avatar

Laravel - Search through table by name & pagination

I'm making an admin panel and on my users page, I have a table with 53 users. (without pagination). On top of that table, I have an input field which is supposed to act as a search bar. But I don't know how to make it. I want the user to search a username and then the results immediately pop-up without a refresh. So the search needs to be searching by first name. Are there any

Rainieren's avatar
Rainieren's avatar Yamen8yrs agoLaravel
1
1
Last reply by Yamen 8yrs ago
anp24's avatar

pagination , page size select not displaying in view-components/grids

I have included the following code in my controller $provider = new EloquentDataProvider(User::class); //$provider = new DbTableDataProvider($pdoConnection, 'my_table'); $input = new InputSource($_GET); $columns = [ 'id' => new Column('Edit'), 'name' => new Column('name'), '

anp24's avatar
anp24's avatar anp248yrs agoLaravel
5
1
Last reply by anp24 8yrs ago
Cheers02's avatar

laravel pagination error

i have pagination in my view, and i have filter so the link will be like thishttp://localhost:8000/home#red but when i click page 2 the link will be like this http://localhost:8000/filter?color=red&page=2 i cant go to page 2

Cheers02's avatar
Cheers02's avatar Cheers028yrs agoLaravel
2
1
Last reply by Cheers02 8yrs ago
Cheers02's avatar

Send ajax from view to controlelr, controller send back json and pagination suitable from json

this ini my problem.. i have a lot of data, example 1000 data, and i create pagination 15 data each page in table.. and i have 3 link to filter my data, this link send ajax string to my controller, and then my controller will send back json to my view.. but i have problem i cant replace my table to the json from my controller this is my javascript function filter($color) {

Cheers02's avatar
Cheers02's avatar RamjithAp8yrs agoLaravel
3
1
Last reply by RamjithAp 8yrs ago
noushid's avatar

Custom pagination URL

With the default laravel pagination my url looks like mydomain.com/item?page=2 Is there a way to obtain something like mydomain.com/item?page=2#something

noushid's avatar
noushid's avatar Snapey8yrs agoLaravel
1
1
Last reply by Snapey 8yrs ago
kmj1993's avatar

want to add pagination to search product page in laravel

I want to add pagination to my searching product item view using my show controller This is my controller public function show($id) { $categories = Item::all(); $products = Item::find($id)->products->paginate(3); return view('category.index', compact('categories', 'products')); } This is my view @extends('layout.front') @section('page') <!-- Page Content --> <

kmj1993's avatar
kmj1993's avatar Snapey8yrs agoLaravel
2
1
Last reply by Snapey 8yrs ago
Martha's avatar

Laravel Pagination

I used laravel pagination so many times , I want to understand how it works and how far it's efficient . Thanks in advance

Martha's avatar
Martha's avatar robrogers38yrs agoLaravel
1
1
Last reply by robrogers3 8yrs ago
dohisev's avatar

Limit the pagination link amount

I'm using Bootstrap 4 and it seems that the pagination isn't responsive, but even so the amount of links on the current Laravel pagination is way bigger than expected and I was wondering how to make it smaller. (I'm using Laravel 5.5) How to make it like: [<][1][2][...][6][7][>] (example)?

dohisev's avatar
dohisev's avatar FounderSta...3yrs agoGeneral
9
1
Last reply by FounderStartup 3yrs ago
LaraBABA's avatar

Quick question on pagination with laravel 5.5

Hello, When I used to code my pagination away from frameworks, I used to create 2 queries: 1 query that counts the number of record in the given table, the output of this query was populating the "previous no1, no2,no3....next" pagination area And the second query was outputting the record with a limit, let's say 15 at the time. By doing so, my paginations were prett

LaraBABA's avatar
LaraBABA's avatar Boubou8yrs agoLaravel
5
1
Last reply by Boubou 8yrs ago
vinoth06's avatar

Pagination for Relationship

Hi, I have a Post | Category | User tables. Each post has categories by the user. Now I want to show the Category page, which will show the list of posts belongs to that Category along with the user detail of that post. How to add pagination for Posts. I tried with, =Try 1: I couldn't get the user details of that particular post= public function single( Category $slug ) { r

vinoth06's avatar
vinoth06's avatar vinoth068yrs agoEloquent
2
1
Last reply by vinoth06 8yrs ago
shihabudheen's avatar

Laravel pagination not workig when using group by

In my listing, I have to join with pivot table, when I am joining with pivot table, data repeating if more than one row in pivot table. here If I used laravel pagination with group by, it is not working properly. What will be the solution for the same?

shihabudheen's avatar
shihabudheen's avatar kossa8yrs agoLaravel
1
1
Last reply by kossa 8yrs ago
LaraBABA's avatar

Pagination keep looping with the same results - Laravel 5.5

Hello, I wonder if anyone had the same problem please. I only have 15 results in my db and the pagination numbers are showing from 1 to 137 pages. When I click on a number, it shows the same results again and again. here is my code public function index() { $users = DB::table('users') ->join('roles', 'roles.id', '=', 'users.role_id') ->joi

LaraBABA's avatar
LaraBABA's avatar Boubou8yrs agoLaravel
3
1
Last reply by Boubou 8yrs ago
guillermo_rojas's avatar

Pagination unavailable when filter function is used

Hi everyone: I' stucked once again. I'm developing a "search" feature. I have a form This is the view {{-- Search view --}} {!! Form::open(['route' =>'admin.properties.search', 'method' => 'GET']) !!} <div class="form-group"> {!! Form::label('state_id', 'Región')!!} {!! Form::select('state_id', $states, null, ['class' => 'form-control'

guillermo_rojas's avatar
guillermo_rojas's avatar guillermo_...8yrs agoLaravel
5
1
Last reply by guillermo_rojas 8yrs ago
crysel's avatar

Lumen fractal Include and pagination

Hello, I try to create a fractal user include and pagination. The include is working fine but the pagination not. Maybe someone can help me with this problem. The method to paginate all results of Article: public function getAll() { $articles = Article::paginate(3); return $articles; } The method to return the right response public function index

crysel's avatar
crysel's avatar crysel8yrs agoLumen
0
1
LaraBABA's avatar

Pagination in laravel 5.5 cannot get it to show up

Hello, In my controller I have this: use Illuminate\Pagination\Paginator; public function index() { $companies = DB::table('companies')->get(); $paginators = DB::table('companies')->simplePaginate(5); return view('company.index', ['companies' => $companies, 'paginators' => $paginators]); } In the view <div class="container">

LaraBABA's avatar
LaraBABA's avatar ftrillo8yrs agoLaravel
1
1
Last reply by ftrillo 8yrs ago
Lina's avatar

Laravel how to modify pagination on vendor correctly

Hello what I want to do is to modify the pagination page by default of laravel to change the layout (CSS) and some html things, he identified the file path a modification that is: provider / laravel / framework / src / Light / Page / resources / views / default.blade.php And I want to change it to a file that called it new.blade.php with a paginator conntent changeing some clas

Lina's avatar
Lina's avatar Lina8yrs agoLaravel
1
1
Last reply by Lina 8yrs 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.