Laravel 9 Multiple Where Condition Query Example

Websolutionstuff | Sep-30-2022 | Categories : Laravel

In this article, we will see the laravel 9 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. Sometimes we need multiple conditions in the query. So, we will give you how to create multiple where clause query using laravel 9 eloquent.

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 produce below:

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


You might also like :

Recommended Post
Featured Post
How To Get Current Date And Time In Vue Js
How To Get Current Date And Ti...

In this article, we will see how to get the current date and time in vue js. In vue js very simple to get the current da...

Read More


Google Autocomplete Address In Laravel 8
Google Autocomplete Address In...

In this example we will see how to google autocomplete address in laravel 8. In laravel 8 google autocomplete address tu...

Read More


How to Generate QR Code in Node.js
How to Generate QR Code in Nod...

In this example we will see how to generate QR Code in Node.js application. In this example we will use qrcode npm...

Read More


Google Map With Draggable Marker Example
Google Map With Draggable Mark...

In this example I will show you how to add a google map to your website, In many websites you can see they have added ma...

Read More