$itemsPaginated = Model::where(function ($query) use ($request) { if ($request->id) $query->where('id', $request->id); }) ->offset($request->input('limit', 10) * $request->input('page', 1)) ->paginate($request->input('limit', 10)); $itemsTransformed = $itemsPaginated ->getCollection() ->map(function ($item) { return [ 'id' => $item->id, 'title' => $item->title, 'key' => $item->key, 'type' => $item->type, ]; })->toArray(); $data = new \Illuminate\Pagination\LengthAwarePaginator( $itemsTransformed, $itemsPaginated->total(), $itemsPaginated->perPage(), $itemsPaginated->currentPage(), [ 'path' => FacadesRequest::url(), 'query' => [ 'page' => $itemsPaginated->currentPage() ] ] ); return response()->json(['status' => 'success', 'data' => $data]);//For Pagination //Follow some steps //1. set pagination value in controller DB::table('users') -> paginate(15) //2 show pagination in blade file @if ($items->hasPages()) <div class="pagination-wrapper"> {{ $items->links() }} </div> @endif //3. if you face css issue in blade file add write your css or just enable bootstrap for it //Open file -> app/Providers/AppServiceProvider.php //add use Illuminate\Pagination\Paginator; // add below given line in boot function public function boot() { Paginator::useBootstrap(); // } php artisan vendor:publish --tag=laravel-pagination$users = User::where('votes', '>', 100)->paginate(15); $users = User::where('votes', '>', 100)->simplePaginate(15); $users = User::where('votes', '>', 100)->cursorPaginate(15);] $users = User::paginate(15)->withQueryString(); $users = User::paginate(15)->fragment('users'); $users = User::where('votes', '>', 100)->paginate( $perPage = 15, $columns = ['*'], $pageName = 'users' ); <div class="container"> @foreach ($users as $user) {{ $user->name }} @endforeach </div> {{ $users->links() }} {{ $users->onEachSide(5)->links() }} use Illuminate\Pagination\Paginator; /** * Bootstrap any application services. * * @return void */ public function boot() { Paginator::useBootstrapFive(); Paginator::useBootstrapFour(); } # The JSON from the paginator will include meta information such as total, current_page, last_page, and more. The result records are available via the data key in the JSON array. Here is an example of the JSON created by returning a paginator instance from a route: { "total": 50, "per_page": 15, "current_page": 1, "last_page": 4, "first_page_url": "http://laravel.app?page=1", "last_page_url": "http://laravel.app?page=4", "next_page_url": "http://laravel.app?page=2", "prev_page_url": null, "path": "http://laravel.app", "from": 1, "to": 15, "data":[ { // Record... }, { // Record... } ] } Paginator / LengthAwarePaginator Instance Methods Each paginator instance provides additional pagination information via the following methods: Method Description $paginator->count() Get the number of items for the current page. $paginator->currentPage() Get the current page number. $paginator->firstItem() Get the result number of the first item in the results. $paginator->getOptions() Get the paginator options. $paginator->getUrlRange($start, $end) Create a range of pagination URLs. $paginator->hasPages() Determine if there are enough items to split into multiple pages. $paginator->hasMorePages() Determine if there are more items in the data store. $paginator->items() Get the items for the current page. $paginator->lastItem() Get the result number of the last item in the results. $paginator->lastPage() Get the page number of the last available page. (Not available when using simplePaginate). $paginator->nextPageUrl() Get the URL for the next page. $paginator->onFirstPage() Determine if the paginator is on the first page. $paginator->perPage() The number of items to be shown per page. $paginator->previousPageUrl() Get the URL for the previous page. $paginator->total() Determine the total number of matching items in the data store. (Not available when using simplePaginate). $paginator->url($page) Get the URL for a given page number. $paginator->getPageName() Get the query string variable used to store the page. $paginator->setPageName($name) Set the query string variable used to store the page. Cursor Paginator Instance Methods Each cursor paginator instance provides additional pagination information via the following methods: Method Description $paginator->count() Get the number of items for the current page. $paginator->cursor() Get the current cursor instance. $paginator->getOptions() Get the paginator options. $paginator->hasPages() Determine if there are enough items to split into multiple pages. $paginator->hasMorePages() Determine if there are more items in the data store. $paginator->getCursorName() Get the query string variable used to store the cursor. $paginator->items() Get the items for the current page. $paginator->nextCursor() Get the cursor instance for the next set of items. $paginator->nextPageUrl() Get the URL for the next page. $paginator->onFirstPage() Determine if the paginator is on the first page. $paginator->onLastPage() Determine if the paginator is on the last page. $paginator->perPage() The number of items to be shown per page. $paginator->previousCursor() Get the cursor instance for the previous set of items. $paginator->previousPageUrl() Get the URL for the previous page. $paginator->setCursorName() Set the query string variable used to store the cursor. $paginator->url($cursor) Get the URL for a given cursor instance.DB::table('users') -> paginate(15) //2 show pagination in blade file @if ($items->hasPages()) <div class="pagination-wrapper"> {{ $items->links() }} </div> @endif@if ($paginator->hasPages()) <ul class="pagination pagination"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) <li class="disabled"><span>«</span></li> @else <li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">«</a></li> @endif @if($paginator->currentPage() > 3) <li class="hidden-xs"><a href="{{ $paginator->url(1) }}">1</a></li> @endif @if($paginator->currentPage() > 4) <li><span>...</span></li> @endif @foreach(range(1, $paginator->lastPage()) as $i) @if($i >= $paginator->currentPage() - 2 && $i <= $paginator->currentPage() + 2) @if ($i == $paginator->currentPage()) <li class="active"><span>{{ $i }}</span></li> @else <li><a href="{{ $paginator->url($i) }}">{{ $i }}</a></li> @endif @endif @endforeach @if($paginator->currentPage() < $paginator->lastPage() - 3) <li><span>...</span></li> @endif @if($paginator->currentPage() < $paginator->lastPage() - 2) <li class="hidden-xs"><a href="{{ $paginator->url($paginator->lastPage()) }}">{{ $paginator->lastPage() }}</a></li> @endif {{-- Next Page Link --}} @if ($paginator->hasMorePages()) <li><a href="{{ $paginator->nextPageUrl() }}" rel="next">»</a></li> @else <li class="disabled"><span>»</span></li> @endif </ul> @endif{{ $mahasiswas->links('pagination::simple-bootstrap-4') }}//controller function to return view public function index() { $data = ModelName::where(condition)->paginate(5); return view('viewPath', compact('data')); } //paste this in view, where pagination to be display {{$data->links()}}<div>Showing {{($users->currentpage()-1)*$users->perpage()+1}} to {{$users->currentpage()*$users->perpage()}} of {{$users->total()}} entries </div>php artisan vendor:publish --tag=laravel-pagination OR use Illuminate\Pagination\Paginator; public function boot() { Paginator::defaultView('your-pagination-view-name'); }