Created
August 29, 2014 09:13
-
-
Save coreymcmahon/27564bd2daf9207b00f1 to your computer and use it in GitHub Desktop.
Using the Repository Pattern - example 1 - http://www.slashnode.com/why-use-repository-pattern/
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 PostRepository | |
{ | |
public function getRecent() | |
{ | |
return Post::where('date', '>', Carbon::now()->subDays(7))->get(); | |
} | |
public function getRecentFor($user_id) | |
{ | |
return Post::where('date', '>', Carbon::now()->subDays(7)) | |
->where('user_id', $user_id)->get(); | |
} | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment