laravel框架 where 和 orWhere 并用多条件语句
AdminsOrg::select('id', 'name','email','mobile','is_super','remember_token','org_id')
->where('password','=',$password)
->where(function($query) use($userName){
$query->where('email','=',$userName)
->orWhere(function($query) use($userName){
$query->where('mobile','=',$userName);
});
})
->first();
;
AdminsOrg::select('id', 'name','email','mobile','is_super','remember_token','org_id')
->where(function($query) use ($userName,$password){
$query->where('password','=',$password)->where('email','=',$userName);
})
->orWhere(function($query) use ($userName,$password){
$query->where('password','=',$password)->where('mobile','=',$userName);
})
->first();
;