laravel where condition multiple code example

Example 1: laravel where multiple conditions

$query->where([
    ['column_1', '=', 'value_1'],
    ['column_2', '<>', 'value_2'],
    [COLUMN, OPERATOR, VALUE],
    ...
])

Example 2: laravel select record with several conditions

public function index(){    $users = User::select('*')                ->where('active', '=', 1)                ->where('is_ban', '=', 0)                ->get();       dd($users);}

Example 3: laravel select record with several conditions

public function index(){    $users = User::select('*')                ->where([                    ['active', '=', 1],                    ['is_ban', '=', 0]                ])                ->get();       dd($users);}

Tags:

Php Example