Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created February 8, 2014 08:51
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 coreymcmahon/8878763 to your computer and use it in GitHub Desktop.
Save coreymcmahon/8878763 to your computer and use it in GitHub Desktop.
A Pattern for Reusable Repository Design in Laravel - http://www.slashnode.com/reusable-repository-design-in-laravel/
<?php
$repo = new Acme\Repositories\UserRepository;
// echo the name of the user with id 1
echo $repo->find(1)->name;
// echo the number of users with username = johnsmith
echo count($repo->findByUsername('johnsmith'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment