look at the link description when looking at the paging
the blogger says that what is provided at the bottom of the laravel needs to use. I directly use UrlWindow;
what"s wrong?
$window = UrlWindow::make ($posts);
public function fetch()
{
// 62
$posts = Post::paginate(6)->onEachSide(2)->withPath(url("post"));
// URL
$window = UrlWindow::make($posts);
$pages = array_filter([
$window["first"],
is_array($window["slider"]) ? "..." : null,
$window["slider"],
is_array($window["last"]) ? "..." : null,
$window["last"],
]);
return response()->json([
"paginator" => $posts,
"elements" => $pages
]);
}