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

MyLibrary's avatar

Pagination with existing paramethers in the URL?

I know my threads subjects may confuse some of you, but let me explain a bit better: I've the resourceful route: Route::resource('deposits', 'DepositsController'); So in order to show all deposits I ofcurse visit the URI: url.com/deposits And at the bottom I've the pagination feature (using "render"), that redirect to the deisred page, for instance: url.com/deposits?

MyLibrary's avatar
MyLibrary's avatar MyLibrary9yrs agoLaravel
4
1
Last reply by MyLibrary 9yrs ago
mpjraaij's avatar

User Pagination

Hi there, I'm working on a new application in Spark Laraval in which I'll list tons of users in the kiosk mode. I'm not an avid programmer, certainly not in vue.js. Has anyone created pagination for the User Listing section already? If not, how could I best create pagination in Spark / Vue.js? Also that it only loads the data when the page is loaded, meaning: not load everythin

mpjraaij's avatar
mpjraaij's avatar mpjraaij9yrs agoSpark
0
1
AlsonicTech's avatar

Pagination with changing content

This is a known issue for every developer when using pagination. I did not found any simple solutions, except using something complicated like google pagination cursor. We have the next scenario: Our pagination object has 5 items per page and 10 items in total Page 1 will display: item1, item2, item3, item4, item5 We delete item4 and item5 Page 2 will display: item8, item9, it

AlsonicTech's avatar
AlsonicTech's avatar JoeDawson9yrs agoLaravel
3
1
Last reply by JoeDawson 9yrs ago
nikocraft's avatar

problem with pagination

I have this code in controller where I get the tag based on slug and then all the posts belonging to the tag and I paginate them $tag = Tag::where('slug', $slug)->first(); $posts = $tag->posts()->published()->paginate(1); return view('posts.tag')->withTag($tag)->withPosts($posts); inside Post model public function tags() {

nikocraft's avatar
nikocraft's avatar SmokeTM9yrs agoEloquent
1
1
Last reply by SmokeTM 9yrs ago
israelnyc's avatar

Pagination not showing on last page with one result

I may be missing something really obvious but I'm trying to use pagination for the first time and it works unless the last page has one result. Then it doesn't show pagination at all (not a style issue; no ul.pagination on the page). The query: $posts = Post::orderBy('updated_at', 'desc')->paginate(5); return view('index', compact('posts')); View (also tried with render me

israelnyc's avatar
israelnyc's avatar jlrdw9yrs agoEloquent
3
1
Last reply by jlrdw 9yrs ago
CellNull's avatar

Ordering versioned Projects with pagination

I am having some struggles with a combination of factors that work nice individualy, but together it starts causing me some headaches: I have Project models which have a OneToMany relation to different ProjectVersions which store the actual project data (title, description etc), and each time this data is altered a new version is stored so I can display the change history of a

CellNull's avatar
CellNull's avatar CellNull9yrs agoEloquent
0
1
bestmomo's avatar

[5.3] Pagination

There is something weird with Laravel 5.3 pagination : There is always the pagination even if we dont exceed the pagination number. Worst : say we have 4 records and you paginate on 3, the pagination is ok on first page but doesn't appears on second one. What do you think ? Looks like a bug...

bestmomo's avatar
bestmomo's avatar bestmomo9yrs agoEloquent
9
1
Last reply by bestmomo 9yrs ago
joedawson's avatar

5.3 Pagination links rendered when unnecessary?

Hello everyone, Within the backend of my application I paginate a lot of resources. Before 5.3's release, when you rendered the links for pagination - they were never rendered if you only had one page, right? All of my applications below 5.3 definitely work this way. Since upgrading one of my projects to 5.3, if a resource has a single page - i still displays the pagination (wi

joedawson's avatar
joedawson's avatar jekinney9yrs agoLaravel
7
1
Last reply by jekinney 9yrs ago
shacall2's avatar

Pagination buttons not showing

I'm a bit perplexed with this. I've done pagination on 2 other sites of mine, without any issues (those were Laravel 5.1). This site is running Laravel 5.2. Pagination is working properly, but not showing the buttons. I assumed the buttons were being rendered from bootstrap.css, but I couldn't locate it. Right now, the pagination links are text only (<< 1 2 3 4 &g

shacall2's avatar
shacall2's avatar shacall29yrs agoLaravel
1
1
Last reply by shacall2 9yrs ago
Lugi's avatar

Constraining Eager Loads and Pagination

Here is my initial request for fetching 10 latest active posts: $posts = Post::where('status', 'active') ->latest('updated_at') ->paginate(10); I would like to do Eager Loading so I get posts with images. Later I'll pass that data to Controller. How to do this Eager Loading but also do the pagination for 10 latest active posts ? I tried to somehow combine with(

Lugi's avatar
Lugi's avatar Loogey9yrs agoEloquent
6
1
Last reply by Loogey 9yrs ago
elfeffe's avatar

Persist form checkboxes (select and others) on pagination

I have a form where I select some options for my query, I'm adding pagination and all works good. Except that I lose the form data when I press "page 2" I'm using Laravel 5.2 Is to keep data on session the only way to keep form state?

elfeffe's avatar
elfeffe's avatar elfeffe9yrs agoLaravel
7
1
Last reply by elfeffe 9yrs ago
zahedkamal87's avatar

Pagination replacing new search results with old ones when try to change page

I've added a ajax search box in app's home page. It works fine. But when i use the pagination after the new results shows up, pagination leads me to the old results. I'm not sure what I'm not doing right. So looking for expert's help to get a solution for it. I've these in routes -- Route::get('/', 'BookmarkController@index'); Route::post('/', 'BookmarkController@search'); I'v

zahedkamal87's avatar
zahedkamal87's avatar jlrdw9yrs agoCode Review
3
1
Last reply by jlrdw 9yrs ago
Razvan's avatar

Eloquent custom pagination similar to Reddit's

The normal laravel/eloquent (simple) pagination will use pages and can be achieved by doing something like this: $posts = Post::with(array('user'=>function($q){ $q->select('id', 'img','nick', 'points', 'slug'); }))->with('categories') ->with('voted') ->orderBy('rank', 'DESC') ->orderBy('created_at','DESC') -&

Razvan's avatar
Razvan's avatar Razvan9yrs agoEloquent
0
1
Mfrancik's avatar

Dynamic Pagination

I would like to use bootstrap pagination: http://getbootstrap.com/components/#pagination-default. I have a "dashboard" view which shows all apartment residents. Two apartments will be using this, one big one small. I want to be able to dynamically add pagination only when needed. I want to show 15 residents, but if it grows automatically create the pagination. Ho

Mfrancik's avatar
Mfrancik's avatar Jaytee9yrs agoGeneral
1
1
Last reply by Jaytee 9yrs ago
6ber6ou's avatar

Ajax Pagination

Hi All. I made a default pagination to display a list of items. How can I transform this pagination to Ajax ? HomeController.php : $latest_activities = LastestActivities::latest()->paginate( 5 ); return view( 'home', compact( 'latest_activities' ) ); home.blade.php <div class="text-right"> {!! $latest_activities->links() !!} </div>

6ber6ou's avatar
6ber6ou's avatar 6ber6ou9yrs agoLaravel
1
1
Lars-Janssen's avatar

Laravel pagination info

Hello, How do I get the following info with my json response: current_page: 1, from:1, 
last_page:1,
 next_page_url:null,
 per_page:5, 
prev_page_url:null, to:5, total:5
 I use pagination like this: $rides = $user->rides() ->with('user', 'location', 'type') ->paginate(1); It should be set by default. (https://laravel.com/docs/5.1/pagination)

Lars-Janssen's avatar
Lars-Janssen's avatar lars649yrs agoLaravel
5
1
Last reply by lars64 9yrs ago
kognitif's avatar

Pagination With An Array

Hi. I have a problem with pagination. im getting rows with a loop; $gelenBolum=array(); foreach ($tercih->gelen() as $gelenid) { $gelenA=\App\KayitLisans::where(['boid' => $gelenid])->first(); if($gelenA!=null) { $gelenB=$gelenA['attributes']; $gelenB['taban_puan'][3]=&quo

kognitif's avatar
kognitif's avatar SaeedPrez9yrs agoLaravel
1
1
Last reply by SaeedPrez 9yrs ago
KHAN's avatar

Refactor Laravel 5 and Ajax Pagination.

Hey, I have 2 lists of data on my page. Both data are paginated using ajax and both data have the same filters. Can you help me refactor my code. Controller class DashboardController extends Controller { public function __construct() { $this->user = Auth::user(); } /** * Display a listing of the resource. * * @return \Illuminate\Http

KHAN's avatar
KHAN's avatar KHAN9yrs agoCode Review
0
1
KHAN's avatar

Laravel 5 Ajax Pagination

Can anyone give me an example of how i can get ajax pagination to work with Laravel 5. Ive seen some old tutorials using L4 but it does not seem to work with the new l5 pagination. if ($request->ajax()) { return response()->view('dashboard.partials.products')->with('products', $products)) ->render();

KHAN's avatar
KHAN's avatar Filip_Zdra...9yrs agoLaravel
6
1
Last reply by Filip_Zdravkovic 9yrs ago
Dark.Hades's avatar

How to custom Pagination render

I want to custom the class bootstrap 3 -> 4 of the pagination how to do this?

Dark.Hades's avatar
Dark.Hades's avatar bobbybouwm...9yrs agoLaravel
1
1
Last reply by bobbybouwmann 9yrs ago
tavares's avatar

Pagination - Load also view

Hi, i have a table with pagination and when i click in next page icon the view is loaded. controller function: public function index() { $items = Items::where('active', '=', 1)->paginate(5); return view('app/items.index', array('items' => $items)); } jquery: function pagination() { $(document).on("click", ".pagination a", function(e) { e.preventDefault

tavares's avatar
tavares's avatar jlrdw9yrs agoCode Review
1
1
Last reply by jlrdw 9yrs ago
mjonat's avatar

Pagination problems...

I'm so close to getting this one I can taste it but unfortunately stuck and cant find anyone else in a similar situation (surprisingly!?). Right...so I am making a search query...which is working fine and I am getting everything I want but I need to paginate results. The input for the search form is just 3 drop down select fields and the result has to match all 3...here is the

mjonat's avatar
mjonat's avatar mjonat9yrs agoGeneral
2
1
Last reply by mjonat 9yrs ago
tavares's avatar

Pagination - how to work with paginations

Hi, I'm working with a lot of tables and i'm using pagination but when i click to the next pagination i go to another page and i want to stay in the same page but with new data... How can i do that? MY QUERY: $itemsSizes = ItemsSize::join('items', 'items_sizes.id_item', '=', 'items.id') ->where('items.active', '=', 1) ->orderBy('items_sizes.updated_at', 'asc') ->simple

tavares's avatar
tavares's avatar Snapey9yrs agoLaravel
4
1
Last reply by Snapey 9yrs ago
se1team2's avatar

How to display a table with pagination

Hey all, So, I'm the Product Owner in a Software Engineering class at my Uni. For our 2 semester long project, we are using PHP and Laravel. In my group, 4 of us have had PHP experience in a Server Side course. However, we did not learn anything MVC related, so if my questions seem... odd, then I'll apologize upfront. Here's my current question: We are wanting to display a l

se1team2's avatar
se1team2's avatar se1team29yrs agoLaravel
2
1
Last reply by se1team2 9yrs ago
rob897's avatar

Help with pagination

Here is my function that checks to see which property type was chosen, then does a couple where queries. The tables (Residential, Apartment, Rental) all have identical fields just different data: public function searchProperties(Request $request) { $type = $request->input('propertyType'); if($type == "residential") { $this->builder = Residen

rob897's avatar
rob897's avatar rob8979yrs agoEloquent
4
1
Last reply by rob897 9yrs ago
sarathiscookie's avatar

How can I add pagination in listing page using vue js and laravel?

I have a listing page using vue js and laravel. In this page filtering and sorting functionality is also included. Currently listing, sorting and filtering are working fine. I need to include pagination in this listing page. I don't know how to include this my client need this. I have not too much experiance in vue js side. My current code is given below. Could you please check

sarathiscookie's avatar
sarathiscookie's avatar sarathisco...9yrs agoLaravel
0
1
ronit5rg's avatar

Why does jQuery doesn't get applied to the results of Laravel pagination from page 2 onwards

I have created a js file to go with my posts's like and dislike function. Also, I have used Laravel's paginate method to make 10 posts in a single page. But, I don't know why the javascript doesn't seem to work for the posts from page 2 onwards. UPDATE: this is my js file: $('.option1').on('click', function (event) { var flagL=0; var flagD=0; event.preve

ronit5rg's avatar
ronit5rg's avatar ronit5rg9yrs agoCode Review
2
1
Last reply by ronit5rg 9yrs ago
giwrgos's avatar

How to add indexing on loop (Blade) with pagination

Hello, I have a list of objects that I have selected with the pagination function. I want to add an index number on the table during the loop. So on the first page to be like 1-10 (if the pagination is 10), on the second page (11-21) and so one for the other pages. If i use foreach with key and value the key always starts from 0 on any page. Does anyone know how i can add index

giwrgos's avatar
giwrgos's avatar willvincen...9yrs agoGeneral
6
1
Last reply by willvincent 9yrs ago
rifki's avatar

Vue pagination with limit

Hello guys, I created a pagination component, this pagination has links limit just like Laravel pagination. Currently everything seems to be working fine but I had doubt since I'm not good in math, please review my code especially on links computed data. Here is my code: <nav v-if="show"> <ul class="pagination"> <li :class="{

rifki's avatar
rifki's avatar rifki9yrs agoVue
0
1
nicklaw5's avatar

How to return select('column, titles') with eager loading and pagination?

I have realised that it is not possible to do eager loading with a select statement after reading this post. My question is: how am i able to select only certain columns alongside eager loading and pagination. See my current code below as an example? class ForumThread extends Model { /** * Get the user that owns the thread. */ public function owner() {

nicklaw5's avatar
nicklaw5's avatar nicklaw59yrs agoEloquent
2
1
Last reply by nicklaw5 9yrs ago
mezie's avatar

Is this possible in Laravel Pagination

Working with pagination in Laravel and I was wondering if ?page=N can be customized in any way. I dont want the query string to be included in my URI.

mezie's avatar
mezie's avatar mezie9yrs agoLaravel
9
1
Last reply by mezie 9yrs ago
timokfine's avatar

Go to last page of pagination?

I have a simple process where users submit posts to a thread. A controller stores the new post and redirects them back to the thread along with an anchor to the new post: return redirect('thread/' . $thread->id . '#post-' . $post->id); // http://domain.com/thread/23#post-45 Here's my problem... Threads are currently paginated with 20 posts per page. When it redirects bac

timokfine's avatar
timokfine's avatar Anthonynzu...6yrs agoLaravel
3
7
Last reply by Anthonynzube 6yrs ago
Chareice's avatar

How to use union with pagination?

I searched before with google, http://stackoverflow.com/questions/25338456/laravel-union-paginate-at-the-same-time. this answer has a problem that must load all data from database table before pagination. Is there any good way to solve using paginate with union at the same time?

Chareice's avatar
Chareice's avatar hdsavani7yrs agoLaravel
2
1
Last reply by hdsavani 7yrs ago
MehulBawadia's avatar

Manual Pagination in Laravel 5.1

How to create a manual pagination in Laravel 5.1 ? I have an array of results (more than 25 result) fetched from the database. I am trying to implement Laravel Pagination in my application. What I want is paginate the results fetched. What I get is pagination of the same results. The code that I have used so far: <?php $productsInParent = $category->products; $productsInP

MehulBawadia's avatar
MehulBawadia's avatar jrean9yrs agoLaravel
4
1
Last reply by jrean 9yrs ago
Seif5's avatar

Angular/Laravel pagination api

Hello ,I am new with angularJS/laravel , so I succed to get all my api resource with laravel and angularJS. but I still want to make a pagination to the api.

Seif5's avatar
Seif5's avatar Amelie8910yrs agoLaravel
10
1
Last reply by Amelie89 10yrs ago
Khudadad's avatar

Ajax Pagination Issue

I want to make the default laravel pagination do not refresh the page and following http://sharpten.com/blog/2014/10/02/ajax-based-pagination-laravel-4.html tutorial but not working. getting 500 Internal error in Chrome console ( GET http://localhost:8000/stock?page=2 500 (Internal Server Error)) Any help.

Khudadad's avatar
Khudadad's avatar Khudadad10yrs agoLaravel
6
1
Last reply by Khudadad 10yrs ago
jimmygns@me.com's avatar

pagination link doesn't work as expected

I just added a pagination to my view, and I did the following. $currentPage = LengthAwarePaginator::resolveCurrentPage(); $collection=collect($followers); $perPage=5; $currentPageResults = $collection->slice(($currentPage-1) * $perPage, $perPage)->all(); //Create our paginator and pass it to the view $paginatedResults= new LengthAw

jimmygns@me.com's avatar
jimmygns@me.com's avatar SaeedPrez10yrs agoLaravel
12
1
Last reply by SaeedPrez 10yrs ago
mbadamchi@gmail.com's avatar

Search Pagination without refreshing the page

Hi, I want to add pagination to my search result. But by default, laravel pagination refresh the page each time user navigate through pages and I don't want it. How to add pagination to the page that doesn't refresh the page?

mbadamchi@gmail.com's avatar
mbadamchi@gmail.com's avatar mbadamchi@...10yrs agoLaravel
5
1
Last reply by [email protected] 10yrs ago
Terumi's avatar

Reverse pagination order

Hello, I've created a service in which people are discussing in a facebook-like wall. The messages are displayed with pagination. I'm offering a way for people to see their messages in chronological order and in a reverse order. For the reverse order, the last message sits on top. For the chronological the oldest sits on top and if someone wants to see the last message, he has

Terumi's avatar
Terumi's avatar Terumi10yrs agoGeneral
1
1
Last reply by Terumi 10yrs ago
Raimondas's avatar

Slider for pagination Laravel 5.2

Hi, is there are any sliders for pagination for laravel ?

Raimondas's avatar
Raimondas's avatar Raimondas10yrs agoLaravel
0
1
X-Coder264's avatar

Pagination with lazy (eager) loading

I don't know how to implement pagination on a project (I'm doing a forum). I have ForumThread, ForumPost and User models. What I have so far is this: class ForumThread extends Model { /** * Get all posts of a thread. */ public function posts() { return $this->hasMany(ForumPost::class, 'thread_id', 'id'); } } class ForumPost extends Model {

X-Coder264's avatar
X-Coder264's avatar X-Coder26410yrs agoGeneral
0
1
alex-arriaga's avatar

Best option to have pagination with friendly URL

What would be the best option to have pagination with friendly URL? I mean, this kind of URL: http://site.com/page/2 instead of having http://site.com/?page=2

alex-arriaga's avatar
alex-arriaga's avatar alex-arria...8yrs agoLaravel
2
1
Last reply by alex-arriaga 8yrs ago
JackD's avatar

Eloquence pagination

seems there's a problem with the pagination using Eloquence package, anyone solved this? i tried this code to paginate but the next button is not working and does not return any error message User::search($request->input('search-key'), $fulltext = false)->paginate(10);

JackD's avatar
JackD's avatar JackD10yrs agoGeneral
1
1
Last reply by JackD 10yrs ago
fatenfalfoul's avatar

How can I create a pagination system

How can I create a pagination system in my example because in the controller I test if a field or more are posted there, and here is my code : the controller's method : /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function search(Request $request)

fatenfalfoul's avatar
fatenfalfoul's avatar fatenfalfo...8yrs agoVue
4
1
Last reply by fatenfalfoul 8yrs ago
avescasio's avatar

Modal form with ajax table pagination problem

Basically I wanted to create a modal form with table list of campaign that is ajax paginated, my problem is every I change the pages inside modal it loads the whole page of accounts create.blade.php My sample code hereunder: in AccountController.php public function create() { ... $campaigns = Campaign::paginate(10); return view('accou

avescasio's avatar
avescasio's avatar avescasio10yrs agoLaravel
3
1
Last reply by avescasio 10yrs ago
tsmvision01's avatar

Laravel 5.2 - pagination issue with select box

Hello, I am having issue with pagination and select box. my select box is rest to default whenever I click page button 2, 3, 4........ Please let me know if anyone know how to keep the select box value when I click another pages. Here is my controller class MemberListTestController extends Controller { public function search(Request $request) { $request->flash(); $memberNam

tsmvision01's avatar
tsmvision01's avatar masterpowe...10yrs agoCode Review
1
1
Last reply by masterpowers 10yrs ago
Dimple's avatar

Is laravel 4 provide pagination on scroll?

i am trying to use pagination on scroll but it is not supported by laravel 4. please suggest some another way for pagination on scroll.

Dimple's avatar
Dimple's avatar jlrdw10yrs agoEloquent
2
1
Last reply by jlrdw 10yrs ago
fastforward's avatar

Custom pagination number of pages before dots (...)

Hello, I made custom pagination style by extending BootstrapThreePresenter and I have one small issue. By default pagination full url range multiplier is 3, and I want to change it, because 8 pages until first dots (...) are abit too much. I couldn't find a way without changing it in source files, any ideas how and if its even possible to change? You can find it in Illuminate\P

fastforward's avatar
fastforward's avatar tpdewolf10yrs agoLaravel
5
1
Last reply by tpdewolf 10yrs ago
muhsinmoosa's avatar

Post comments pagination

I want to reverse the comments order of each blog post. Also apply pagination to it. Please Help.

muhsinmoosa's avatar
muhsinmoosa's avatar Prez10yrs agoLaravel
1
1
Last reply by Prez 10yrs ago
robopetr's avatar

Laravel, Vue and pagination

I had a brief look and couldn't find a topic regarding Laravel, Vue and pagination in the series. It would be great to see a screen cast about this!

robopetr's avatar
robopetr's avatar ABDELRHMAN10yrs agoRequests
2
1
Last reply by ABDELRHMAN 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.