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

Kareimovich's avatar

i need to make pagination for episode like animy

My Controller public function index() { // $animes = Anime::All(); $animes = Anime::paginate(1); return view('welcome',compact('animes')); } public function view(anime $anime) { return view('show', compact('anime')); } @foreach ($anime->episode as $episode) {{ $episode->episode_Name}} {{$episode->anime_story}}

Kareimovich's avatar
Kareimovich's avatar arthurvill...2yrs agoLaravel
3
1
Last reply by arthurvillar 2yrs ago
moses's avatar

How can I display pagination laravel on the vue component?

My controller like this : public function index() { $products = $this->product->list(); dd($products); return view('admin.product.index',compact('products')); } The result of dd($products); like this : https://postimg.org/image/w39usbfrv/ My view blade laravel like this : <section class="content"> <product-list :product-data="{{js

moses's avatar
moses's avatar ejdelmonic...8yrs agoLaravel
1
1
Last reply by ejdelmonico 8yrs ago
moses's avatar

How can I pass pagination data and array from controller laravel to vue component?

My controller like this : public function index() { $products = $this->product->list(); dd($products); return view('admin.product.index',compact('products')); } The result of dd($products); like this : https://postimg.org/image/w39usbfrv/ My view blade laravel like this : <section class="content"> <product-list :products="{{$produ

moses's avatar
moses's avatar Joucke8yrs agoLaravel
3
1
Last reply by Joucke 8yrs ago
bobington's avatar

Keep checked box from one page to another with Laravel Pagination

hi, I was wondering if you could store what checkbox are checked between the page with laravel? my controller: public function index() { $values = DB::table('mytable')->limit(10) ->paginate(50); return view('index', compact('values')); } my html: <form action="/test" method="POST"> <button class

bobington's avatar
bobington's avatar Heyaj058yrs agoLaravel
2
1
Last reply by Heyaj05 8yrs ago
devamit2018's avatar

pagination by drop down

i want to paginate the view page according to drop-down values selected....

devamit2018's avatar
devamit2018's avatar petar_vukc...3yrs agoLaravel
19
5
Last reply by petar_vukcevic 3yrs ago
Mike_91's avatar

Pagination and data

a

Mike_91's avatar
Mike_91's avatar BezhanSall...8yrs agoLaravel
10
1
Last reply by BezhanSalleh 8yrs ago
iamdvsan's avatar

Laravel Pagination not working

I am trying to paginate records, but it shows me error. public function index(){ $posts = Post::get(); return view('index')->with('posts', $post); } If I use following link, it will show error. {{ $posts->links() }}

iamdvsan's avatar
iamdvsan's avatar iamdvsan8yrs agoLaravel
2
1
Last reply by iamdvsan 8yrs ago
devBasanta's avatar

Pagination not working

Here's my code. When I dd($post) it shows 3 item but in view it shows all the 6 items I don't know. Neither it shows any error. I want to display only 3 posts. public function categories($slug) { $category = Category::where('slug',$slug)->first(); $posts = $category->posts()->paginate(3); $categories = Category::all(); $title = $cate

devBasanta's avatar
devBasanta's avatar devBasanta8yrs agoLaravel
2
1
Last reply by devBasanta 8yrs ago
eddy1992's avatar

pagination for api.

Hi guys I have two queries that would fetch records for me but I am using laravel paginator and I feel its making it slow, I am doing this query for api /** * we would search the products 1 table * with all the request params posted * we would query only when the request * params are passed. * @param object $data This is the request param * @retu

eddy1992's avatar
eddy1992's avatar eddy19928yrs agoEloquent
4
1
Last reply by eddy1992 8yrs ago
devBasanta's avatar

Pagination not Working for front end

Undefined property: Illuminate\Pagination\LengthAwarePaginator::$name public function categories($slug) { $category = Category::where('slug',$slug)->paginate(5); $categories = Category::all(); $title = $category->name; $settings = Setting::first(); return view('category',compact('category','categories','title','settings'));

devBasanta's avatar
devBasanta's avatar devBasanta8yrs agoLaravel
6
2
Last reply by devBasanta 8yrs ago
LeachCreative's avatar

API Endpoint Pagination

I'm wanting to use a bunch of GET params to build a query using the query builder for my API. The result will end up being paginated, however when I go to the next page, all of my GET params are gone. Suggestions?

LeachCreative's avatar
LeachCreative's avatar SyedAbutha...8yrs agoEloquent
1
1
Last reply by SyedAbuthahir 8yrs ago
dinni's avatar

pagination with merged results

hi how to paginate the merged results. $stocks=$stocks1->merge($stocks2); where $stocks1 and $stocks2 are two query results;

dinni's avatar
dinni's avatar abusalameh8yrs agoLaravel
1
1
Last reply by abusalameh 8yrs ago
shez1983's avatar

small problem with pagination on (catalogue section)

https://laracasts.com/lessons?skill=2 it says there are TWO pages but second page is EMPTY... no results

shez1983's avatar
shez1983's avatar 368648yrs agoFeedback
3
1
Last reply by 36864 8yrs ago
sitmgreg's avatar

combining sortby / pagination : best practices?

I'm curious how people solve the typical search / filter problem in Laravel. I see that paginate() nicely interprets the URL in the controller, https://laravel.com/docs/5.5/pagination#displaying-pagination-results hints that it's easy to add additional parameters to a paginated link (like sort). Is this usually done by adding scopes to models and looking at Input::get()?

sitmgreg's avatar
sitmgreg's avatar jlrdw8yrs agoEloquent
1
1
Last reply by jlrdw 8yrs ago
Ab.net's avatar

laravel pagination on filter

this is my code in my view blade <div class="row m0 filters_row"> <ul class="gallery-filter causes-filter nav pull-left"> <li data-filter=>All</li> @foreach($categories as $filter) <li data-filter=".{{$filter->id}}">{{$filter->name}}</li>

Ab.net's avatar
Ab.net's avatar Ab.net8yrs agoLaravel
1
1
Last reply by Ab.net 8yrs ago
Ab.net's avatar

Can't use pagination on hasMany relationship...

here is my controller.. namespace App\Http\Controllers\Frontend; use App\Category; use App\Gallery; use App\images; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class GalleryController extends Controller { public function index(Gallery $gallery,images $image ){ $galleries=$gallery->with('images')->get(); $categories=Category::all(); //to

Ab.net's avatar
Ab.net's avatar Ab.net8yrs agoLaravel
3
1
Last reply by Ab.net 8yrs ago
pasanmherath's avatar

How join two queries and do pagination

Result1 = Product::select('product_detail_id', 'product_name as title') ->where('category_id', 6) ->where('company_id', 3) ->get(); if($idArray){ $result2 = Product::select('product_detail_id', 'product_name as title') ->whereIn('category_id', $

pasanmherath's avatar
pasanmherath's avatar tuneless8yrs agoLaravel
5
1
Last reply by tuneless 8yrs ago
roddyp's avatar

Laravel 5.5 Pagination for Bootstrap 4

How do I get the render method to output HTML for Bootstrap 4 rather than 3? I see bootstrap-4.blade.php and other view files in \Paginations\resources\views, but I don't know how/where to specify which one to use. Sorry for the noob question as I'm still feeling my way around this stuff, and most of the info I've found seems to refer to earlier Laravel releases.

roddyp's avatar
roddyp's avatar copain7yrs agoLaravel
15
3
Last reply by copain 7yrs ago
hal9k's avatar

How to limit pagination to X items/pages

Hello, I'm making a simple video site and I'm trying to display top 100 videos for each genre, split to 20 videos per page (total 5 pages). This is what I have right now $top100videos = Videos::where('genre', $genre) ->orderby('rating', 'desc') ->with('actors') ->paginate(20); but that returns every single vi

hal9k's avatar
hal9k's avatar ahmadissa8yrs agoEloquent
22
1
Last reply by ahmadissa 8yrs ago
toby's avatar

[L5.4] Pagination: Change query name for "?page=x" globally

Hi everyone, I want to rename the ?page=42 parameter name globally. Currently, what I've done is to use something like this: // AppServiceProvider.php public function boot() { Paginator::currentPageResolver(function() { return $this->app['request']->input('seite'); }); } // XxxController.php public function index() { $companies = Company::paginate()

toby's avatar
toby's avatar toby8yrs agoLaravel
2
1
Last reply by toby 8yrs ago
vinschi's avatar

Problem with Service Provider and pagination

Hi guys, I defined the booth() method in my AppServiceProvider in this way: public function boot() { \View::composer('*', function ($view) { $movies = \Cache::remember('movies', 1, function () { return Movie::all(); }); $view->with('movies', $movies); }); } so that I have all the movies in each view

vinschi's avatar
vinschi's avatar vinschi8yrs agoLaravel
1
1
Last reply by vinschi 8yrs ago
charlieBrown's avatar

How to add a button filter to filter results from pagination

I would like to add a button to filter the results returned by paginate. I have been looking into the documentation but I'm not beeing able to use the docummentation's example to my case. <table class="table"> <thead> <tr> <th>First Name</th> <th>Last Name</th> <th>Link

charlieBrown's avatar
charlieBrown's avatar charlieBro...8yrs agoLaravel
0
1
charlieBrown's avatar

pagination with Laravel using GET

I'm trying to use the paginate method in Laravel but I'm not getting how I'll use paginate when I have parameters passed via GET request. I would like to have a URL like this: public/pesquisar?profissao=Advogado&distrito=Aveiro and still be able to use paginate. Search Controller return view('search.mostrarUsuarios', array('profissoesUser' => $profissoesUser)); Html <

charlieBrown's avatar
charlieBrown's avatar jlrdw8yrs agoLaravel
3
1
Last reply by jlrdw 8yrs ago
douglas_quaid's avatar

Potential security concerns on custom pagination

Hello, I've extended the LengthAwarePaginator class to allow for multiple parameters of the same name. http://localhost:8000/api/examples?q=hello&q=test With LengthAwarePaginator it returns the following for nextPageUrl & prevPageUrl nextPageUrl: http://localhost:8000/api/examples?q%5B0%5D=hello&q%5B1%5D=test&page=3 prevPageUrl: http://localhost:8000/api/exampl

douglas_quaid's avatar
douglas_quaid's avatar douglas_qu...9yrs agoLaravel
1
1
Last reply by douglas_quaid 9yrs ago
altoin's avatar

Pagination and Radio Button Value

Hello everyone, i have a simple quiz application that displays 1 question per-page to users. Everything works for now, but i noticed that once a user navigates away from a page, the radio button on the page is unchecked. Is there're a way to retain radio button checked value till the form is submitted. here is my code. @foreach($question as $q)

altoin's avatar
altoin's avatar altoin9yrs agoCode Review
2
1
Last reply by altoin 9yrs ago
asolopovas's avatar

When using scout search with load method pagination disappears

Hi everyone, I am having strange trouble loading paginated search results that are retrieved via laravel socut. https://laracasts.com/discuss/channels/laravel/laravel-scout-and-with?page=2 In my case I have Orders with customer if I do something like that Order::search('1')->get(); It retrieves search results, if I do Order::serach('1')->paginate(5); it retrieves paginate

asolopovas's avatar
asolopovas's avatar asolopovas9yrs agoLaravel
0
3
Lars-Janssen's avatar

Lazy load with pagination

Hello, I've got this in my controller: 'reactions' => $message->reaction->load('user', 'user.corporation')->paginate(2) When I do that ^ I get this error: Method paginate does not exist. Is it possible to lazy load + paginate?

Lars-Janssen's avatar
Lars-Janssen's avatar mdecooman9yrs agoLaravel
1
1
Last reply by mdecooman 9yrs ago
onujaar's avatar

How to use pagination with where condition and with data from 3 tables?

For example I have three tables: users(user_id), game(game_id, name), game_progresses(id, user_id, game_id, percent). // edited I would like to return all the above data to a view and then display it in a table with columns: "Game name:" , "My progress:" (the percent on completion of the logged in player) In my controller the paginated() function should r

onujaar's avatar
onujaar's avatar Snapey9yrs agoEloquent
3
1
Last reply by Snapey 9yrs ago
agahi's avatar

Customizing pagination with bootstrap

Hi I have this code to output page links on the page: {{$properties->links()}} This outputs a very simple line of numbers. I see on the document something like this: $results->firstItem(); Where does this $result come form? How can I convert this paginator to a JSON or a class so I can see what I have and be able to manipulate it.

agahi's avatar
agahi's avatar Screenbeet...9yrs agoLaravel
1
1
Last reply by Screenbeetle 9yrs ago
dom082186's avatar

Filtering data using fields and pagination

I need to filter data using three input fields if i filter on the first two fields it's fine but when i put data on the third field it's been prioritized and the data in two field is not filtered. Here is my controller public function find_a_jobseeker ( Request $request ) { $jobseekers_list = DB::table( 'users' )->where( [ [ 'role', 'jobseeker' ] ] )->whereNotNull( 'updat

dom082186's avatar
dom082186's avatar SaeedPrez9yrs agoLaravel
1
1
Last reply by SaeedPrez 9yrs ago
suubcs's avatar

Laravel Json Pagination

Hello , i have a JSON DATA , that's have a structure like this { id: 1, user_id: "1", title: "MBxyo", comment: "HBMpOirpUKCTLIJqRey0Om42XAtgh5", date_message: "2017-03-18", read: 0 }, { id: 2, user_id: "1", title: "qsd", comment: "qds", date_message: "2017-03-18", read: 0 }, In my ApiController i

suubcs's avatar
suubcs's avatar Abi9yrs agoLaravel
1
2
Last reply by Abi 9yrs ago
wkinne's avatar

Using Vue Js and Laravel Pagination

Hey Everyone, Curious if anyone has implemented a scroll feature with Vue and Laravel. I would like to load each page as the user scrolls. For example the first 25 from an ajax call load, then when the user scrolls to the bottom of that list, load another 25 and so one. I know you can call paginate on the query, but how could I do this with vue? Just pass the page with the requ

wkinne's avatar
wkinne's avatar Abi9yrs agoVue
1
1
Last reply by Abi 9yrs ago
newbie360's avatar

Laravel 5 suggest the pagination don't hard coding the ul tag by default

since no logic for the ul tag <ul class="pagination"> </ul> i just thinking most newbies like me can easy add the open and close tag ofc if the ul tag is not hard coding then easy change to <ul class="pagination pull-right inline pagination-lg"> now i really don't know how to easy can do this ;(

newbie360's avatar
newbie360's avatar newbie3609yrs agoLaravel
7
1
Last reply by newbie360 9yrs ago
Cheebamba's avatar

Best practice fetching records. (pagination)

Hi, I wonder what is best practice when pulling records from db with ajax: pull all of them and switch pages with vue, OR pull one page, and refresh when searching/filtering? I guess it depends on table size, but lets say theres 1000 records. Thanks!

Cheebamba's avatar
Cheebamba's avatar Cheebamba9yrs agoVue
2
1
Last reply by Cheebamba 9yrs ago
Indemnity83's avatar

Date based pagination

I would really like to be able to "paginate" an eloquent query by date (specifically so all rows from a particularly date are grouped on each "page", going to the previous page would go to the previous date). Is this something that the paginate (probably simplePaginator) can handle in Laravel; or is this best handled with some custom query scoping?

Indemnity83's avatar
Indemnity83's avatar mikefolsom9yrs agoEloquent
1
1
Last reply by mikefolsom 9yrs ago
RJA's avatar

Manual Pagination not working

Hi everyone, I'm using raw sql to get data from the database, but now i can't use the method paginate, so i manually paginate my array: $parts= DB::select("SELECT pro.name AS 'pro_name', parts.* FROM programs pro, parts WHERE pro.id = parts.Pro_id)->paginate(4); -> not working $parts= DB::select("SELECT pro.name AS 'pro_name'

RJA's avatar
RJA's avatar RJA9yrs agoLaravel
4
1
Last reply by RJA 9yrs ago
codemode's avatar

Pagination error

I'm trying to paginate my view, but i get this error - Call to undefined method Illuminate\Database\Query\Builder::links() Controller function - public function index() { $imc_obj = Imc::where('user_id', Auth::id())->paginate(5); return view('imc.index', compact('imc_obj')); } View file - @foreach ($imc_obj as $imcs)

codemode's avatar
codemode's avatar jlrdw9yrs agoLaravel
1
1
Last reply by jlrdw 9yrs ago
shamon's avatar

Laravel 5.3 : pagination orm left join query results gives empty

I am trying to paginate a left join query result here is my code $result = Art::leftJoin('cushbu_users',function ($join){ $join->on('cushbu_arts.artist_id', '=', 'cushbu_users.id'); }) ->where('category',$category) ->where('status',1) ->paginate(1,[ 'cushbu_users.name

shamon's avatar
shamon's avatar shamon9yrs agoLaravel
0
1
lara123's avatar

How to use pagination with offset and limit in laravel5.3 using ORM ?

$all_data1 = Infoall::with('location','user')->where('user_id','=',$user->id) ->whereBetween('photos.image_date_time',array($start_date,$end_date)) ->orderBy('photos.image_date_time', 'DESC')->get(); $all_data = $all_data1->toArray(); // For all objects into array colletion . Infoall my model name.

lara123's avatar
lara123's avatar lara1238yrs agoLaravel
3
1
Last reply by lara123 8yrs ago
MWDeveloper's avatar

Change the pagination links' color

Hi devs I want to change the color of post index's links. So i tried to inspect the element of the links in my index blade page and i did it on the browser and when I want to copy the page content of "pagination.less" I did not find it within the path "assets/css/less/pagination.less" any idea ?

MWDeveloper's avatar
MWDeveloper's avatar MWDevelope...9yrs agoGeneral
4
1
Last reply by MWDeveloper 9yrs ago
nikocraft's avatar

how would I add index to result when using pagination

I want to give index to each result from a query, something like this page 1 1 2 3 4 5 page 2 6 7 8 9 10 page 3 etc How would I do that? I can't use the id from the table, and I can't use $loop->index to print out a number, since that would reset for each page. How would I give index to all returned results and have it work accors all the pages

nikocraft's avatar
nikocraft's avatar nikocraft9yrs agoLaravel
0
1
pbelyaev's avatar

Pagination custom page urls

By default Laravel offers urls like this /users?page=2. This is pretty cool, but I want it to be like this /users/page/2. Also, I want to throw 404 when the page is out of pages range. Is there any package that does the trick or any elegant solution?

pbelyaev's avatar
pbelyaev's avatar pbelyaev9yrs agoLaravel
2
1
Last reply by pbelyaev 9yrs ago
insight's avatar

How to create a pagination result corresponding to single table in multiple tables join?

Dear Friends, I know how to paginate a single Table query result in controller like below: $pages = Magazine::latest('created_at')->paginate(7); return view('magazines.viewpage', compact('pages')); But in case of join how I can do this . From documentation can see $pages = \DB::table('magazine_details') ->join('magazines', '

insight's avatar
insight's avatar insight9yrs agoLaravel
1
1
Last reply by insight 9yrs ago
Hikaro's avatar

Laravel 5.3 Pagination With Query Builder Problem [Solved]

the following code: $data = User::orWhere(function($query) use ($request){ if ($name = $request->input("name")) { $query->orWhere("name", 'LIKE', '%'.$name.'%'); } if ($email = $request->input("email")) { $query->orWhere("email", 'LIKE', '%'.$email.'%');

Hikaro's avatar
Hikaro's avatar Hikaro9yrs agoLaravel
6
1
Last reply by Hikaro 9yrs ago
Lars-Janssen's avatar

Eager loading pagination

Hello, Is it possible to paginate an eager loaded relation? I've got this: $message = Message::with('files', 'user', 'reactions') ->orderBy('created_at', 'DESC') ->paginate(1); And I would like to paginate the reactions?

Lars-Janssen's avatar
Lars-Janssen's avatar getvma9yrs agoLaravel
3
1
Last reply by getvma 9yrs ago
pay2all's avatar

how can i make grid with pagination

my code @{{ item.type }} @{{ item.provider }}-@{{ item.number }} @{{ item.id }} @{{ item.created_at }} @{{ item.amount }} @{{ item.total_balance }} @{{ item.status }}

pay2all's avatar
pay2all's avatar pay2all9yrs agoVue
2
1
Last reply by pay2all 9yrs ago
Waldemar's avatar

Title pagination page number

Hello! I need add to title number page! For example <title>Products Page 2</title> When i am press to Page 2 Title still Products

Waldemar's avatar
Waldemar's avatar MWDevelope...9yrs agoLaravel
3
1
Last reply by MWDeveloper 9yrs ago
Lars-Janssen's avatar

Pagination eror

Hi, I've got a strange problem. When I return this in my ForumController: public function index() { return Forum::with('topics') ->orderBy('created_at', 'DESC') ->paginate(10); } I receive the error: Exception in JsonResponse.php line 65: Failed calling Illuminate\P agination\LengthAwarePaginator::jsonSerialize() in JsonResponse.php line 65 at json

Lars-Janssen's avatar
Lars-Janssen's avatar lars69yrs agoLaravel
5
1
Last reply by lars6 9yrs ago
jhansi's avatar

The pagination and search are not working inthe table of my bootstrap theme.what to do?

tables.blade.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="">

jhansi's avatar
jhansi's avatar Snapey9yrs agoLaravel
3
1
Last reply by Snapey 9yrs ago
Duke_Reno's avatar

Changing Laravel Pagination next/previous PageUrl

So i have 3 paginated catalogs, which are in order, lets say: x= 3 pages; y= 2 pages; z= 6 pages; What i want is, if you are in the last page of "x" or "y" catalogs, then instead of having a "NULL" for next page url, i want to set it to the first page of the next catalog so if: (x->CurrentPage()==3){ x->setNextPageUrl(y); //this "setter

Duke_Reno's avatar
Duke_Reno's avatar Duke_Reno9yrs agoLaravel
0
1

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.