src/SetPageMiddleware.php
public function handle($request, Closure $next)
    {
        Paginator::currentPageResolver(function () {
            return app('paginateroute')->currentPage();
        });

        return $next($request);
    }
public function handle($request, Closure $next)
    {
        Paginator::currentPageResolver(function () {
            return app('paginateroute')->currentPage();
        });

        return $next($request);
    }
public function handle ( $ request , Closure $ next ) { Paginator :: currentPageResolver ( function ( ) { return app ( 'paginateroute' ) -> currentPage ( ) ; } ) ; return $ next ( $ request ) ; }
Set the current page based on the page route parameter before the route's action is executed.

@return \Illuminate\Http\Request
Set the current page based on the page route parameter before the route s action is executed .