Using pagination in Laravel Framework
Questions tagged [laravel-pagination]
197 questions
29
votes
3 answers
Laravel Pagination is showing weird arrows
So I used simple Laravel pagination command of {{$posts->links()}} displaying 5 posts on one page.
Laravel's pagination is doing its job but it is displaying weird arrows. Refer the image below and please if someone is willing to help can ask me for…

Xtinct
- 301
- 1
- 3
- 3
15
votes
8 answers
Laravel 5 - Manual pagination
Pagination::make() method doesn't exist in Pagination class anymore in Laravel 5.
Is there a workaround to make manual pagination work in Laravel 5?

aBhijit
- 5,261
- 10
- 36
- 56
9
votes
5 answers
Laravel pagination not working with group by clause
It seems Laravel pagination does not working properly with group by clause. For example:
$users = Subject::select(DB::raw('subjects.*, count(user_subjects.id) as total_users'))
->join('user_subjects', 'user_subjects.subject_id', '=',…

Anam
- 11,999
- 9
- 49
- 63
8
votes
2 answers
Laravel 5 - Finding the pagination page for a model
I am working on building a basic forum (inspired by laracasts.com/discuss). When a user posts a reply to a thread:
I'd like to direct them to the end of the list of paginated replies with their reply's anchor (same behavior as Laracasts).
I'd…

NightMICU
- 9,000
- 30
- 89
- 121
7
votes
5 answers
How to use transform in paginated collection in laravel
I want to use map or transform in paginated collection in laravel 5.5 but I am struggling it work
This is what I was trying to do but getCollection is not available in LengthAwarePaginator as what we used to do in previous laravel versions see: How…

Theodory Faustine
- 432
- 2
- 10
- 22
7
votes
1 answer
How to paginate with return as json laravel
I want to create a pagination with return as json, but I'm getting an error like below
ErrorException in Macroable.php line 74:
Method links does not exist.
here my controller code
public function getcustomer($id){
$customer =…

rafitio
- 550
- 3
- 15
- 36
6
votes
2 answers
get pagination data by a specific page number
I want to get Data by page number,
in normal when we use this code
$jobs = Jobs::paginate(10);
laravel get data by GET "page" parameter that defined in URL,
if our URL be http://www.example.com/job?page=2
laravel return data of page 2
I want to do…

Mahdi mehrabi
- 1,486
- 2
- 18
- 21
6
votes
5 answers
Using limit parameter in paginate function
Is it possible to use 'limit' parameter in paginate() function?
I'm trying this:
$users->where(...)->limit(50)->paginate($page)
...and now, if I have 100 users in the database then the response from paginate function will be all 100 users instead…

Damjan Krstevski
- 265
- 1
- 5
- 15
6
votes
5 answers
laravel show only next and previous link in pagination
I ma trying to use Laravel Pagination and I only want to show the Previous and Next link with out the number 1 2 3 ...
how could I do that? I followed Laravel page :
"Simple Pagination"
If you are only showing "Next" and "Previous" links in your…

user3150060
- 1,725
- 7
- 26
- 46
5
votes
2 answers
laravel paginate when use select case and parameter binding
Laravel Version: 5.5
PHP Version:7
Hi, I want to execute this query:
select (case
when(title like 'my-keyword') then 1
when(description like 'my-keyword') then 2
) as ordering from products where id > 10;
When I do this by query…

Roham Shojaei
- 440
- 4
- 18
5
votes
2 answers
laravel hydrateRaw/fromQuery and eager loading with pagination
I currently found out that you can hydrate an Raw sql query.
I have following query:
DB::table(DB::raw('(SELECT *, Y(location) AS longitude, X(location) AS latitude FROM meetings WHERE MBRCONTAINS(@quadrat, location)) AS sub'))
…

Ronon
- 738
- 10
- 26
5
votes
3 answers
Laravel pagination showing duplicate and replacing random row
I am using laravel 5.4 with pagination and I have an issue where a row from my database shows up twice, once on two out of the 4 pages. When I delete the row however both are removed but the total count of rows using the count only shows -1 and then…

Stoff
- 517
- 6
- 22
5
votes
1 answer
Laravel pagination not working with array instead of collection
I'm trying to paginate an array data set and it has proven more challenging than I thought.
I'm using Laravel 5
So I have an abstract interface/repository that all my other models extend to and I created a method inside my abstract repository call…

Harry Geo
- 1,163
- 3
- 10
- 24
5
votes
2 answers
Laravel 5 Pagination linking to wrong place
I'm currently updating one of my projects to Laravel 5 from 4.2. I'm aware a lot has changed with the paginator class but i really can't figure out why this isn't working. I call paginate() on eloquent models at multiple locations in my project and…
user2158316
4
votes
4 answers
Laravel fetch data from two tables without join with pagination
I want to fetch results from two tables properties and properties_x where properties.address or properties_x.address_x like test with laravel pagination.
There is no foreign key relationship between these two tables.
properties
id name …

Harpal Singh
- 694
- 6
- 27