Questions tagged [laravel-pagination]

Using pagination in Laravel Framework

Filter by
Sorted by
Tagged with
29 votes
3 answers
15k views

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 ...
Xtinct's user avatar
  • 301
16 votes
4 answers
33k views

Laravel How to display $hidden attribute on model on paginate

I'm using Laravel 5.5. I read about this and know this function and it works makeVisible $hidden = ['password', 'remember_token', 'email']; I can display email using $profile = auth()->user()-&...
Goper Leo Zosa's user avatar
15 votes
8 answers
24k views

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's user avatar
  • 5,261
9 votes
5 answers
15k views

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('...
Anam's user avatar
  • 12k
8 votes
2 answers
9k views

Syntax error or access violation: 1140 Mixing of GROUP columns laravel

I have written this query with pagination in it $items = Item::select('items.*', 'sub_category_name', 'category_name', 'sub_category_slug', 'category_slug') ->join('sub_categories AS sc', '...
Alex's user avatar
  • 105
8 votes
2 answers
4k views

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 ...
NightMICU's user avatar
  • 9,020
7 votes
5 answers
9k views

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 ...
Theodory Faustine's user avatar
7 votes
1 answer
31k views

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 ...
rafitio's user avatar
  • 560
6 votes
5 answers
24k views

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 ...
user3150060's user avatar
  • 1,725
6 votes
2 answers
10k views

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....
Mahdi mehrabi's user avatar
6 votes
5 answers
21k views

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 ...
Damjan Krstevski's user avatar
5 votes
3 answers
7k views

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 ...
Stoff's user avatar
  • 517
5 votes
2 answers
7k views

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 ...
user avatar
5 votes
1 answer
12k views

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 ...
Harry Geo's user avatar
  • 1,173
5 votes
2 answers
4k views

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(@...
Ronon's user avatar
  • 738
5 votes
2 answers
697 views

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 ...
Roham Shojaei's user avatar
4 votes
1 answer
14k views

Laravel Pagination Error -- Call to undefined method stdClass::links()

I developed a laravel application and i want to paginate a view, look my controller. $times=DB::table('timesheets') ->leftJoin('users', 'timesheets.timesheet_user', '=', 'users.id') ->...
Jishad's user avatar
  • 2,886
4 votes
2 answers
11k views

Laravel pagination get variables

I have a page that list apartments depending on book dates like this mypage.com/finder?date-from=2011-03-04&date-to=2011-03-12 Everything is right, I am getting the date-from and date-get from ...
notforever's user avatar
4 votes
1 answer
27k views

Call to a member function paginate() on array

I am working with Laravel5.0 . I want to add paginate() to the following function of my controller part. public function index() { try{ $val=DB::connection()->getDatabaseName(); ...
Erfan Ahmed's user avatar
  • 1,536
4 votes
3 answers
14k views

Laravel sortBy paginate

I have a posts table and comments table, comment belongs to post, and I have the relationship setup in Post and Comment model. I did sort posts by the number of comments of each post like this: ...
dulan's user avatar
  • 1,584
4 votes
2 answers
1k views

Laravel 5/ 5.4 paginator is not working in NGINX production environement

In my local environment i did $items = Model::paginate(10); and it worked. Then i pushed it to production and when i click on the pagination links it displays page 1 again and again. then i did dd($...
Ahmed Nawaz Khan's user avatar
4 votes
1 answer
270 views

Random characters are added in pagination links in laravel 5.2

I have a little issue, Please take a look. I have shown some data on a page based on some condition filtering, Everything works good except Pagination. I can't add the filter parameters to the ...
Rahul Mangal's user avatar
4 votes
4 answers
10k views

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 ...
Harpal Singh's user avatar
4 votes
1 answer
28k views

Laravel Pagination with eloquent Queries

I am trying to paginate my template which has a table on it. This is my function in the controller which has the eloquent queries. public function orderbydate() { $order =DB::table('...
Jay Desai's user avatar
  • 475
4 votes
1 answer
1k views

Using pretty URLs with Laravel 5.1 Pagination

I am writing a website using the Laravel 5.1 framework, and I'm trying to figure out how to use pretty URLs (pages/2 as opposed to pages?page=2). It actually surprised me that they haven't included a ...
Forest's user avatar
  • 938
4 votes
1 answer
1k views

Pagination not showing after I use Resource to display data

I'm having issues with pagination after I use a resource to display data. Before this, I was using this code to display data, and the output shows the pagination as well. Output Controller $All = ...
Choy 's user avatar
  • 452
4 votes
2 answers
2k views

How to Paginate loaded relation with Laravel API resources

I need to load model relations in it's resource and paginate them. In my case i have Category and Path models, plus CategoryResource and PathResource The toArray method of CategoryResource is like ...
Kareimovich's user avatar
3 votes
1 answer
97 views

Can't use paginate after using switch. - Laravel

I want to use the switch before using paginate. But am getting this error in my view - Call to undefined method Illuminate\Database\Eloquent\Builder::links(). My Code - MyController.php $var = ...
Piyush's user avatar
  • 62
3 votes
2 answers
4k views

How to paginate in Laravel when using Modell::find(array())

I'm grabbing some data in Laravel using the find method and only grabbing the id's I want: $my_ids = array(1,4,5,10); $results = Model::find($my_ids); However, if I try to paginate via Model::find($...
justinl's user avatar
  • 10.5k
3 votes
1 answer
2k views

Laravel Voyager server-side pagination links not showing

I am developing with Laravel 8.4 ("laravel/framework": "^8.40") and Voyager 1.4 ("tcg/voyager": "^1.4"). I am facing an unusual bug with Laravel Voyager. When I ...
Md. Tanvir Hossain's user avatar
3 votes
2 answers
3k views

Laravel 5 how to use pagination with files list?

I have one problem with my script. I did foreach with files list but I need pagination, for example 15 files per site. What should I do now? Thanks for help :) Controller: $files = Storage::allFiles(...
Stanisław Szewczyk's user avatar
3 votes
1 answer
9k views

Laravel 5.0 Pagination render() method return HTML text

I have a controller which send some product to the view. In the controller I paginated the data using ... // Controller code Product::paginate(1) // because I only have 2 dummy data, 1 product per ...
azamuddin's user avatar
3 votes
2 answers
2k views

Laravel Pagination

How can I create a pagination in laravel? My Model Post function comments() { return $this->hasMany('Comment') ->orderBy('created_at', 'desc'); } Comment function posts(...
usrNotFound's user avatar
  • 2,680
3 votes
2 answers
861 views

Laravel Collection paginate does not exist

I'm trying to implement basic pagination when retrieving notifications, but I get the following error. Method Illuminate\Notifications\DatabaseNotificationCollection::paginate does not exist. public ...
Shanediesel's user avatar
3 votes
4 answers
1k views

Display laravel Pagination links twice in a page

I have implemented a laravel pagination in one of my project where pagination is working like a charm. I have a requirement to display a pagination links on top of the table as well as the bottom of ...
Punit Gajjar's user avatar
  • 5,025
3 votes
2 answers
5k views

How to get pagination links using ajax (laravel 4.2)

Good day, How can I pass e.g: $transactions->links(); when doing an ajax call on laravel? Heres my Controller on a normal request: $transactions = DB::table('x_general_transactions') ->...
melvnberd's user avatar
  • 3,093
3 votes
1 answer
2k views

Laravel Livewire Multiple Pagination In One Page

I'm using Laravel Livewire and here I have 3 tables that showing on one page but the problem is the pagination showing correctly but not working(the URL change to http://127.0.0.1:8000/blogpost?...
user13708077's user avatar
3 votes
0 answers
340 views

links method does not exist using laravel pagination?

I am using pagination with Laravel 5.4 by this query. $items = Item::with('likes')->whereStatus('1')->paginate(20); And how i am rendering it in view {{ $items->links() }} this works fine ...
Khirad Zahra's user avatar
3 votes
2 answers
2k views

Laravel Custom Pagination

Having problems getting my pagination to work in Laravel 5.2 I use a foreach to generate a list of objects where each object has a certain ranking. (competition) The first query I used was this one: ...
LucasPoignon's user avatar
2 votes
1 answer
2k views

How to limit the number of page links in Laravel?

I have 500+ records in Users table and I am showing list using following code in my Blade template. In Controller $users= Users::paginate(5); In Blade view $users->links(); This is showing pages ...
atrix's user avatar
  • 23
2 votes
1 answer
3k views

Remove row from pagination inside of transform

I have a variable that is a pagination object $pagination I am changing things inside of it using transform $pagination->getCollection()->transform(function ($item, $key) use(&$data, &...
Goose's user avatar
  • 4,764
2 votes
2 answers
8k views

Laravel 5.4 - get entrys where column contains specific string

I'm geting the following error if I try to get database entrys where the name contains a passed string. Invalid argument supplied for foreach() . $search = $request['search']; $key_search = ...
dwdawdawdaw's user avatar
2 votes
2 answers
3k views

How to get specific columns in Laravel Eloquent with pagination?

I use this table schema: Schema::create('forms', function (Blueprint $table) { $table->increments('id'); $table->string('name', 255)->default(''); $table->text('html')->...
netdjw's user avatar
  • 5,479
2 votes
2 answers
2k views

Manual Pagination Error - Laravel 5.0

I am getting the following error while passing an array, count(array) and itemsPerPage as arguments. Call to undefined method Illuminate\Pagination\Paginator::make() I tried following with it but ...
Hassan Saqib's user avatar
  • 2,607
2 votes
3 answers
4k views

how to add custom(new) column in laravel pagination collection result

I am creating an API and I want to add extra column in the result of pagination query. For example I have price and discount in my database. I want to send discounted_price column with result set. ...
Ashish's user avatar
  • 468
2 votes
2 answers
3k views

laravel having: Column not found

my following code is like this: $places = DivePlace::selectRaw("*,(st_distance_sphere( POINT(".$lon.",".$lat.") , point(lon, lat))/1000) as distance") ->havingRaw("distance < ".$radius) ...
mathisloge's user avatar
2 votes
1 answer
121 views

Paginate doesn't work as expected uisng laravel and jq

I am working on a filtering data. As there is <input> and if someone start typing I am calling jq function to send a request to my controller. It is working fine. Even I am getting filtered data ...
Saurabh Gupte's user avatar
2 votes
2 answers
5k views

How to use laravel pagination with filter

I have getCanSeeAttribute function in post model, and I try to get posts with pagination using filter() $posts = Post::where(function ($query1) use ($users) { $query1->where('...
hossamGamal's user avatar

1
2 3 4 5