Created
April 26, 2017 17:06
-
-
Save Mombuyish/ae343e55957a088a4b0e47796dc83930 to your computer and use it in GitHub Desktop.
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 Post extends Model | |
{ | |
public function scopeActive($query) | |
{ | |
return $query->where('status', 1); | |
} | |
} | |
//PostRepository | |
class PostRepository | |
{ | |
protected $model; | |
public function __construct(Post $model) | |
{ | |
$this->model = $model; | |
} | |
public function getActiveAll() | |
{ | |
return $this->model->active()->get(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment