vendredi 11 mars 2016

Laravel 5.1 Global scope

I have a global scope that exclude deactivated users from query(1 - Activated, 0-Deactivated). But I have troubles with retrieving this deactivated users. I want to create a function that doing the same as withTrashed() method. But i cant figure out how. What should I write in remove method?

UsersScope class

class UsersScope implements ScopeInterface
{
    public function apply(Builder $builder, Model $model)
    {
        return $builder->where('status', '=', 1);
    }

    public function remove(Builder $builder, Model $model)
    {

    }



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire