Created
October 23, 2015 18:13
-
-
Save tanftw/af7953f31d0ddd532db9 to your computer and use it in GitHub Desktop.
Student scope
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 | |
namespace App; | |
use Illuminate\Database\Eloquent\Model; | |
use Illuminate\Database\Eloquent\Builder; | |
use Illuminate\Database\Eloquent\ScopeInterface; | |
class StudentScope implements ScopeInterface | |
{ | |
public function apply(Builder $builder, Model $model) | |
{ | |
$builder->whereRoleId(2); | |
} | |
public function remove(Builder $builder, Model $model) | |
{ | |
// you don't need this | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment