PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, March 11, 2022

[FIXED] pagination not styled in laravel 5.5

 March 11, 2022     laravel-5.5, pagination, styling     No comments   

Issue

Here is my code where I am showing the paginations of my blog posts !!

<div class="clearfix">
    {{ $posts->render() }}
    <a class="btn btn-secondary float-right" href="#">Older Posts &rarr;</a>
</div>

Here is the controller where the pagination function is called.

public function index()
{
    $posts = post::where('status',1)->paginate(2);
    return view('user.blog',compact('posts'));
}

I have tried lot, but my pagination displayed but not properly styled !! Why ??

Here I show what is happening above the black line !!


Solution

To display the pagination links in your blade view:

{{ $posts->links() }}

Or if you need to specify Bootstrap 4:

{{$posts->links("pagination::bootstrap-4")}}

Laravel docs: https://laravel.com/docs/5.5/pagination



Answered By - kerrin
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing