protected function handleInvalidPage(LengthAwarePaginator $paginator)
    {
        if ($paginator->lastPage() && $paginator->currentPage() > $paginator->lastPage()) {
            $lastPageUrl = Request::fullUrlWithQuery([
                $paginator->getPageName() => $paginator->lastPage(),
            ]);

            Pjax::respond(redirect($lastPageUrl));
        }
    }
protected function handleInvalidPage(LengthAwarePaginator $paginator)
    {
        if ($paginator->lastPage() && $paginator->currentPage() > $paginator->lastPage()) {
            $lastPageUrl = Request::fullUrlWithQuery([
                $paginator->getPageName() => $paginator->lastPage(),
            ]);

            Pjax::respond(redirect($lastPageUrl));
        }
    }
protected function handleInvalidPage ( LengthAwarePaginator $ paginator ) { if ( $ paginator -> lastPage ( ) && $ paginator -> currentPage ( ) > $ paginator -> lastPage ( ) ) { $ lastPageUrl = Request :: fullUrlWithQuery ( [ $ paginator -> getPageName ( ) => $ paginator -> lastPage ( ) , ] ) ; Pjax :: respond ( redirect ( $ lastPageUrl ) ) ; } }
If current page is greater than last page, then redirect to last page.

@param LengthAwarePaginator $paginator

@return void
If current page is greater than last page then redirect to last page .