In this tutorial, we will see how to use whereNotBetween query in laravel. You can easily use whereNotBetween in laravel.


Given below are three examples for whereNotBetween query in laravel



Example 1:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = User::whereNotBetween('id', [1, 10])
                ->get();
    dd($users);
}



Example 2:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users = User::whereNotBetween('created_at', [2020-07-15, 2020-07-23])
                ->get();
    dd($users);
}



Example 3:

/**
* The attributes that are mass assignable.
*
* @var array
*/
public function index()
{
    $users =  DB::table('users')
    			->whereNotBetween('created_at', [2020-07-10, 2020-07-15])
                ->get();
    dd($users);
}


I hope this example helps you.