29

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 codes I will share them. a

Muhammad Dyas Yaskur
  • 6,914
  • 10
  • 48
  • 73
Xtinct
  • 301
  • 1
  • 3
  • 3
  • 1
    welcome to SO .. did you checked you are using right bootstrap .? or not – Kamlesh Paul Sep 22 '20 at 03:49
  • Yes I have.I am doing a course on laravel so the instructor provided the bootstrap files – Xtinct Sep 22 '20 at 04:57
  • You have devtools open, so ... use them! :-) Select the arrow on the page, find out what CSS/HTML is causing it. You're going to need to learn how to debug if you're learning to code :-) – Don't Panic Sep 22 '20 at 05:09
  • It's not laravel issue. It happened from front end – A.A Noman Sep 22 '20 at 08:32
  • if its the issue from the front end how can I get to know the location where it is typed in wrong way? – Xtinct Sep 22 '20 at 13:42
  • I think it's a legitimate question. The same happens to me in Laravel 8. It looks like there is a style problem with links() function. I tried a fresh new Laravel 8.x installation with the default bootstrap. This usually works in previous versions. For now try to generate the links manually: https://laravel.com/docs/8.x/pagination – Alexandre Strapacao G. Vianna Sep 22 '20 at 14:28

3 Answers3

61

Here is official document that talk about it. You can check it

Inside AppServiceProvider


use Illuminate\Pagination\Paginator;

public function boot()
{
    Paginator::useBootstrap();
}

Doc: https://laravel.com/docs/8.x/pagination#using-bootstrap

Sample implementation: https://www.itsolutionstuff.com/index.php/post/laravel-8-pagination-example-tutorialexample.html

Sok Chanty
  • 1,678
  • 2
  • 12
  • 22
  • This initially fixed my issue, but after I use "use WithPagination;" it messed up again. I want to use it as it reload page with ajax request. Any solutions. Thanks. – gowlemn Aug 29 '22 at 00:44
40

I put as an argument on the "links" method, a version of Bootstrap which works right:

$posts->links('pagination::bootstrap-4')
Dharman
  • 30,962
  • 25
  • 85
  • 135
Fernando Lz
  • 401
  • 3
  • 2
1

I found the answer to this question here: i used laravel pagination links, but i got big icos. < > call in tailwind css code

You need to add this line to tailwind.config.js under content:

 './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php',
NickOpris
  • 509
  • 2
  • 8
  • 20