Laravel 6 Multiple Where Eloquent Query

Today, We want to share with you Laravel 6 Multiple Where Eloquent Query.In this post we will show you laravel 6 search query with multiple conditions, hear for How to Create Multiple Where Clause Query Using Laravel 6 Eloquent? we will give you demo and example for implement.In this post, we will learn about Eloquent Subquery Enhancements in Laravel 6.0 with an example.

Laravel 6 Multiple Where Eloquent Query

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

Read Also:  Angular 6 HTTP Get Method with Example

As I will cover this Post with live Working example to develop find with where condition in laravel, so the and condition in where clause in laravel is used for this example is following below.

Example : 1 where and whereDate

Movie::select('id','slogen')
    ->where('movie_applicability','=','SPECIFIC_MOVIES')
    ->where('movi_id','=', $movi_id)
    ->where('is_upcomming','=', 1)
    ->whereDate('new_updated_song','>=', NOW())
    ->get();

Example : 2 Laravel 6 Join with Multiple Where conditions

Tamilrokers::join('movie_list_hindi','movie_list_hindi.song_id','=','movie_lists.song_id')
->select('movie_lists.*','movie_list_hindi.*','movie_list_hindi.id as mib_id','movie_lists.item_group_id')
->where('movie_lists.movi_id','=',$movi_id)
->where('movie_lists.is_upcomming','=',0)
->where('movie_lists.song_id','=',$song_id)
->where('movie_list_hindi.is_upcomming','=',0);

Example : 3 where, whereRaw, groupBy, orderBy and DB::raw()

Tamilrokers::select(DB::raw("GROUP_CONCAT(DISTINCT song_id) as movies_list"), 'movi_id')
->where('is_upcomming', 1)
->where('new_updated_song','=', 1)
->whereRaw('updated_at < DATE_SUB(NOW(), INTERVAL 30 MINUTE)')
->groupBy('movi_id')
->orderBy('updated_at','ASC')
->limit(1000);

Example : 4 where, whereIn, whereRaw Example

Tamilrokers::where('is_upcomming', 1)
    ->where('new_updated_song','=', 1)
    ->whereIn('song_id',$movie_list_arr)
    ->whereRaw('updated_at < DATE_SUB(NOW(), INTERVAL 30 MINUTE)')
    ->where('movi_id','=', $movi_id)
    ->get();

Example : 5 Laravel 6 WhereNotIn Query Example

    $movie_ids_web = '71,27,34';
    $movie_ids = explode(',', $movie_ids_web);
    
    $movies = Movie::select("*")
                    ->whereNotIn('id', $movie_ids)
                    ->get();
  
    dd($movies);

Laravel 6 AND-OR-AND + brackets with Eloquent

laravel 6 nested where

$q->where(function ($query) {
    $query->where('movie', 'Hindi')
        ->where('price', '>=', 180);
})->orWhere(function($query) {
    $query->where('movie', 'English')
        ->where('price', '>=', 250);	
})

Web Programming Tutorials Example with Demo

Read :

Read Also:  jQuery Disable Button After Click Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about laravel 6 query with if condition.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  Laravel 6 SubQuery MySQL Tutorial with Examples
  2. Read Also:  multiple where condition in laravel
  3. Read Also:  Laravel query builder multiple where condition
  4. Read Also:  Laravel 6 Eloquent WHERE Like query Example
  5. Read Also:  Laravel User Role based Access control Authentication
  6. Read Also:  Laravel 6 Group By using Eloquent
  7. Read Also:  Laravel 6 Advanced Subqueries Examples
  8. Read Also:  REST API Insert Update Delete using PHP
  9. Read Also:  Custom Global Helpers in Laravel 5.8
  10. Read Also:  laravel order by desc Query Builder
CLOSEX