Skip to content

Instantly share code, notes, and snippets.

@Mombuyish
Created April 26, 2017 17:06
Show Gist options
  • Save Mombuyish/ae343e55957a088a4b0e47796dc83930 to your computer and use it in GitHub Desktop.
Save Mombuyish/ae343e55957a088a4b0e47796dc83930 to your computer and use it in GitHub Desktop.
<?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