Crazylife's avatar

How to change the paginator arrow button to string "next" and "previous"

I am using this Illuminate\Pagination\LengthAwarePaginator to do pagination

// Get current page form url e.x. &page=1
        $currentPage = LengthAwarePaginator::resolveCurrentPage();
        // Create a new Laravel collection from the array data
        $itemCollection = collect($items);
        // Define how many items we want to be visible in each page
        $perPage = 1;
        // Slice the collection to get the items to display in current page
        $currentPageItems = $itemCollection->slice(($currentPage * $perPage) - $perPage, $perPage)->all();
        // Create our paginator and pass it to the view
        $paginatedItems= new LengthAwarePaginator($currentPageItems , count($itemCollection), $perPage);
 
        // set url path for generted links
        $paginatedItems->setPath($request->url());
        return view('items_view', ['items' => $paginatedItems]);
    }

During view the next and previous button show as << and >>. How can i change it to Next and Previous?

0 likes
5 replies
Mittensoff's avatar

Laravel uses boostrap to customize your pagination buttons. Go into the bootstrap css file and find pagination li and a elements and change them appropriately.

Crazylife's avatar

It's not related to the file in below blade template?

Illuminate\Pagination\LengthAwarePaginator
Crazylife's avatar

Ok, i changed wrong template file for the view ;) It works fine right now. Thanks a lot.

Prabakaran's avatar

Laravel uses bootstrap styles ,so change the style directly to :

$('.pager li [rel=prev]').html('Prev');

$('.pager li [rel=next]').html('Next');

Please or to participate in this conversation.