在laravel分页中制作干净的URL

From this url:

http://localhost/testing/public/?page=2

To this url:

 http://localhost/testing/public/page/2

i got an example like this code below with pagination and i want to format url in my pagination look clean and nice like url ahead.

$items = [
    'item1',
    'item2',
    'item3',
    'item4',
    'item5',
    'item6',
    'item7',
    'item8',
    'item9',
    'item10'
];

// 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]);

An example view:

<h1>Items List</h1>     
<ul>
    @foreach ($items as $item) 
        <li> {{ $item }} </li>
    @endforeach
</ul>

<div>
    {{ $items->links() }}
</div>

Any solution for these?

You need to override framework files. But instead of this. You can use this package: https://github.com/DeSmart/pagination

EDIT: I don't know that package supports lastest Laravel version. But you can fork and reuse it.