Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Last active January 3, 2016 05:09
Show Gist options
  • Save coreymcmahon/8413842 to your computer and use it in GitHub Desktop.
Save coreymcmahon/8413842 to your computer and use it in GitHub Desktop.
Building Testable Applications using the Repository Pattern - http://www.slashnode.com/the-repository-pattern/
<?php namespace Acme\Storage;
use Acme\Models\Post;
class PostRepository {
public function paginate($perPage = null, $columns = array('*'))
{
return Post::paginate($perPage, $columns);
}
public function findOrFail($id, $columns = array('*'))
{
return Post::findOrFail($id, $columns);
}
// ...etc
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment