Skip to main content
Laravel Code Completion Medium +20 XP

Eloquent Where

Complete the query to find active users.

LaravelFill in the blank
$users = User::___(  'is_active', true)->get();

Type the missing code

Show answer and explanation

Answer: where

where() adds a WHERE clause to the Eloquent query. Chain get() to execute and retrieve the results.

Hint: Which method adds a WHERE condition?

What this challenge tests

Code Completion in Laravel: eloquent, query-builder.

Related challenges