//Get current page form url e.g. &page=6
        $currentPage = LengthAwarePaginator::resolveCurrentPage();

        $currentPage -= 1;

        //Create a new Laravel collection from the array data
        $collection = new Collection($log_data['content']);

        //Define how many items we want to be visible in each page
        $perPage = 10;

        //Slice the collection to get the items to display in current page
        $currentPageSearchResults = $collection->slice($currentPage * $perPage, $perPage)->all();

        //Create our paginator and pass it to the view
        $paginatedSearchResults= new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage);

        $url = url('admin/statistics/index');

        $paginatedSearchResults = $paginatedSearchResults->setPath($url);

相关文章:

  • 2021-09-20
  • 2021-11-12
  • 2022-12-23
  • 2021-08-08
  • 2021-09-29
猜你喜欢
  • 2021-08-25
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-07-10
相关资源
相似解决方案