-1

我有以下有效的代码:

$name = 'jhon';
$users = DB::table('account')->where('login', '=', $name)->get();

如何指定 AND 参数以便可以查询多个条件?

$login = $request->login;
$password = $request->password;

$users = DB::table('account')->where([
    ['login', '=', $login],
    ['password', '=', $password]
])->get();

不工作。

$users = DB::table('account')
    ->where('login', '=', $login and 'password', '=', $password)->get();

澄清一下,我专门寻找查询构建器解决方案,而不是 Eloquent 解决方案。

4

1 回答 1

0

使用where方法两次:

$users = DB::table('account')
->where('login', '=', $login)
->where('password', '=', $password)
->get();
于 2016-09-06T18:44:20.820 回答