我在用户模型中创建了一个anonimus全局范围,如下所示,以便仅在前端获得公共用户:
protected static function boot()
{
parent::boot();
static::addGlobalScope('is_public', function(Builder $builder) {
$builder->where('is_public', '=', 1);
});
}
Run Code Online (Sandbox Code Playgroud)
但是...当我需要在后端执行登录时,我当然需要检查非公共用户,因此我需要排除全局范围。
是否可以使用laravel的默认AuthController?
非常感谢!!