Two conditions in SQL query with Laravel 4


I need to query MySQL with two conditions. I tried to do this:

$query=DB::table('veteranos')->where('ra', '2300')->where('flag', 0)->pluck('ra');

In this way, the second condition is not working, that is, the query takes values other than 0 for flag . What would be the correct way to do this query?

asked by anonymous 21.12.2015 / 13:04

1 answer


You can do two functions. The second function receives the result of the first query as a parameter.

DB::table('veteranos')->where('ra', '2300')
                return $query
                          ->where('flag', 0)->pluck('ra');
21.12.2015 / 16:47