Breaking

Tuesday, October 6, 2020

Laravel 8 Default Pagination Style Not Work Solution | Laravel Pagination

 Laravel 8 Default Pagination Style Not Work Solution | Laravel Pagination  Here  you just need to change {{ $users->links() }} to {{ $users->links("pagination::bootstrap-4") }}





<?php
//your controller code    
/**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */

    public function home(){
    	
       $users = User::latest()->paginate(5);
        return view('home', compact('users'))
            ->with('i', (request()->input('page', 1) - 1) * 5);
    }

//your blade template home.blade.php 
 <div class="d-flex mt-4 flex-wrap">
          <p class="text-muted">Showing 1 to 10 of 57 entries</p>
                      
            <nav class="ml-auto">
                {{  $users->links("pagination::bootstrap-4") }}
            </nav>
 </div>

?>
Yuo just need to add this line in your view file {{ $users->links("pagination::bootstrap-4") }}

No comments:

Post a Comment

your suggestion are welcome by me