Skip to content

Instantly share code, notes, and snippets.

@seansch
Created March 8, 2017 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seansch/408739e143c9c7e73064539e91943182 to your computer and use it in GitHub Desktop.
Save seansch/408739e143c9c7e73064539e91943182 to your computer and use it in GitHub Desktop.
$collection = new Collection($array);
$perPage = 4;
$currentPageSearchResults = $collection->slice((LengthAwarePaginator::resolveCurrentPage() - 1) * $perPage, $perPage)->all();
$paginatedSearchResults= new LengthAwarePaginator($currentPageSearchResults, count($collection), $perPage);
return $paginatedSearchResults;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment