Skip to content

Instantly share code, notes, and snippets.

@ryanmr
Created March 4, 2015 04:06
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 ryanmr/11d5fb1651143b00ddcc to your computer and use it in GitHub Desktop.
Save ryanmr/11d5fb1651143b00ddcc to your computer and use it in GitHub Desktop.
public function scopeVisible($query) {
return $query
->where('hidden', '=', false)
->where('state', '=', 'published');
}
public function scopeAccessible($query) {
return $query
->where('hidden', '=', false)
->where(function($query){
$query
->where('state', '=', 'preview')
->orWhere('state', '=', 'published');
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment