Skip to content

Instantly share code, notes, and snippets.

@tieutantan
Created May 26, 2018 19:58
Show Gist options
  • Save tieutantan/4cee7c00a585bbf8097a6f270129409f to your computer and use it in GitHub Desktop.
Save tieutantan/4cee7c00a585bbf8097a6f270129409f to your computer and use it in GitHub Desktop.
Simple Pagination
<?php
$limit = config('custom.config.appPerPage');
$offset = ($page > 1) ? (($page - 1) * $limit) : 0;
$apps = App::where('publish', 1)->orderBy('updated_at', 'desc')->take($limit)->skip($offset)->get();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment