Home » Laravel Multiple WHERE conditions – AND, OR, IN, NOT IN

Laravel Multiple WHERE conditions – AND, OR, IN, NOT IN

Today, We want to share with you laravel where condition.In this post we will show you multiple where clause in laravel query builder., hear for laravel two where conditions we will give you demo and example for implement.In this post, we will learn about laravel eloquent multiple where conditions. with an example.

Laravel Multiple Where Condition Example

There are the Following The simple About multiple where condition with laravel Full Information With Example and source code.

Read Also:  How to Send Twitter Automatically Tweets with PHP

. but if you want to added script multiple where clause in laravel then i will give you two example of how to added script multiple where clause in laravel.

As I will cover this Post with live Working example to develop where clause using where() in laravel application, so the multiple where clause in laravel query builder is used for this example is following below.

Read Also:  ERROR 1118 (42000) Row size too large

Also you can easily main 2 types of the execute or run multiple where condition in laravel query.

You can see both syntax of writing multiple where condition:

->where('YOUR_COLUMN_NAME', 'OPERATOR', 'USER_DYNAMIC_STATIC_VALUE')
->where('YOUR_COLUMN_NAME', 'OPERATOR', 'USER_DYNAMIC_STATIC_VALUE')

other Way

->where([
        ['YOUR_COLUMN_NAME', 'OPERATOR', 'USER_DYNAMIC_STATIC_VALUE'],
        ['YOUR_COLUMN_NAME', 'OPERATOR', 'USER_DYNAMIC_STATIC_VALUE']
    ]);

Here, i will give you best Laravel example of how to put multiple where condition with laravel web application.

If you have sql query like as following the with multiple where condition:

Read Also:  MySQL BETWEEN Operators with WHERE Condition

Simple SQL Query:

SELECT * FROM `products` WHERE active = 1 AND is_sell = 0

and Then you can run your sql qurey like as following the both way:

Example 1: Create Multiple Where Clause Query Using Laravel Eloquent

public function index()
{
    $products = Product::select('*')
                ->where('active', '=', 1)
                ->where('is_sell', '=', 0)
                ->get();
   
    dd($products);
}

Example 2: Writing multiple where clause query

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


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  PHP Laravel Multiple Where Condition using Eloquent
  2. Read Also:  PHP Strong Random Number and String Generator
  3. Read Also:  Confirm Dialog Box using jQuery and CSS
  4. Read Also:  WPML Display Different Logo in each language
  5. Read Also:  Wordpress set and get User last login Date and time
  6. Read Also:  Laravel 6 get last Insert id from query builder
  7. Read Also:  Laravel 5.6 Server Side Validation Example
  8. Read Also:  How to convert string number into month name in PHP
  9. Read Also:  MySQL BETWEEN Operators with WHERE Condition
  10. Read Also:  How to convert string number into month name in PHP

Leave a Comment

Your email address will not be published. Required fields are marked *