Created
March 2, 2016 02:01
-
-
Save vinicius73/f9077430f862dda2ab14 to your computer and use it in GitHub Desktop.
Repository Pattern não precisa ser chato
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class UsersRepository | |
{ | |
public function getList($limit = 15, $offset = 0) | |
{ | |
return mysql_query("SELECT * FROM `users` LIMIT {$offset} , {$limit}"); | |
} | |
} | |
$repo = new UsersRepository(); | |
$page = (int) $_GET['page']; | |
$resource = $repo->getList(10, $page * 10); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment