Complete the code to add a simple where clause filtering users by 'active' status.
$users = DB::table('users')->where('status', [1])->get();
The where method filters records where the 'status' column equals 'active'.
Complete the code to filter users whose age is greater than 18 using a where clause.
$users = DB::table('users')->where('age', [1], 18)->get();
The where method with '>' operator filters users older than 18.
Fix the error in the where clause to filter users with email ending in '@example.com'.
$users = DB::table('users')->where('email', [1], '%@example.com')->get();
The LIKE operator is used for pattern matching with wildcards like '%'.
Fill both blanks to filter users who are active and have age less than 30.
$users = DB::table('users')->where('status', [1], 'active')->where('age', [2], 30)->get();
The first where checks for status equal to 'active'. The second where filters age less than 30.
Fill all three blanks to filter users with name starting with 'J', age greater or equal to 21, and status not equal to 'inactive'.
$users = DB::table('users')->where('name', [1], 'J%')->where('age', [2], 21)->where('status', [3], 'inactive')->get();
Use LIKE for name pattern, >= for age at least 21, and != to exclude 'inactive' status.