Laravel 9 Multiple Where Condition Query Example

Websolutionstuff | Sep-30-2022 | Categories : Laravel

In this article, we will see the laravel 9 and laravel 10 multiple where condition query example. We will learn how to write multiple where clauses in the laravel 9 query builder. Also, we will use the where() function in laravel 9/10. Sometimes we need multiple conditions in the query.

So, we will give you how to create multiple where clause queries using laravel 9 eloquent. Also, you can use this multiple where condition in laravel 8, laravel 9, and laravel 10.

The most basic call to the where method requires three arguments. The first argument is the name of the column. The second argument is an operator, which can be any of the database's supported operators.

So, let's multiple where conditions in laravel 9 and laravel 9 where conditions.

Syntax of multiple where condition.



Also, you can write on single where condition.







Example: SQL Query

SQL query with multiple where conditions.

SELECT * FROM `users` 

WHERE votes = 100 AND votes > 35;


Example: laravel multiple where clause

For example, the following query retrieves users where the value of the votes column is equal to 100 and the value of the age column is greater than 35.

Example 1:

$users = DB::table('users')
                ->where('votes', '=', 100)
                ->where('age', '>', 35)


Example 2:

$users = DB::table('users')
                    ['votes', '=', 100],
                    ['votes', '>', 35]



Conditions using Array:

$users = User::where([
       'column1' => value1,
       'column2' => value2,
       'column3' => value3


This query like produced below:

SELECT * FROM TABLE WHERE column1 = value1 and column2 = value2 and column3 = value3


You might also like :

Recommended Post
Featured Post
Introduction of Node.js Modules
Introduction of Node.js Module...

In this tutorial I will give you information about Introduction of Node.js Modules. Node.js modules provide a way t...

Read More


Razorpay Payment Gateway Integration in Laravel 10 and VueJS 3
Razorpay Payment Gateway Integ...

In the rapidly advancing world of technology, the combination of Laravel 10 and VueJS 3 is unparalleled and exceptionall...

Read More


How To Disable Weekends In jQuery Datepicker
How To Disable Weekends In jQu...

In this tutorial, we will see how to disable weekend dates in jquery datepicker. In the date picker, the weeke...

Read More


Laravel 11 Install Yajra Datatable Example
Laravel 11 Install Yajra Datat...

In this tutorial, we'll explore an example of installing Yajra Datatable in Laravel 11. In every project, it's e...

Read More