query multiple condition laravel code example
Example 1: multiple logical condition in laravel query
// ...
$q->where(function ($query) {
$query->where('gender', 'Male')
->where('age', '>=', 18);
})->orWhere(function($query) {
$query->where('gender', 'Female')
->where('age', '>=', 65);
})
Example 2: laravel select record with several conditions
public function index(){ $users = User::select('*') ->where([ ['active', '=', 1], ['is_ban', '=', 0] ]) ->get(); dd($users);}