Solving Queries: Laravel Eloquent's Multiple Where

How To Use Laravel Multiple Where Condition with Example

Laravel Eloquent Multiple Where Condition - StudyWithKishan


               In this article we will what are different ways to use Where condition in your sql query in Laravel Eloquent . Multiple where clause plays an important role whenever you want to retrive data from database with multiple condition . Laravel Eloquent makes it very easy for using multiple where conditions .

                 Let's see how Laravel Eloquent Multiple Where Condition works .

Syntax - 1


 public function index(parameter)
    {

     $data = tablename::select('*')

                ->where('field_name', 'operator', 'value')

                ->where('field_name', 'operator', 'value')

                ->where('field_name', 'operator', 'value')

                ->get();

    }


Syntax - 2 


 public function index(parameter)
    {
    
     $data = tablename::select('*')
     
                ->where([
                
                ['field_name','operator','value'],
                ['field_name','operator','value'],
                ['field_name','operator','value']
                
                ])
                ->get();
    }




Example - 1




Example - 2



       This is the two methods by which you can use multiple where conditions in Laravel .


Thank you For reading this article 😊

Hope it can help you

For any quey do not hesitate to comment 💬
Previous Post Next Post

Contact Form