Laravel WhereBetween Query Example

10-Apr-2023

.

Admin

Hi Guys,

In this example,I will show you how to use where between query in laravel.you can simple use the where between query in laravel.

for example,you will get to user table age but user age get 21 to 30 in table then use to where between query in controller.

You can also get records from where between two date and age. So i give you both example are bellow you can see both example as bellow:

Example 1 :


/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = DB::table('users')

->whereBetween('created_at',['2019-12-25','2019-12-30'] )

->get();

dd($users);

}

Example 2 :

/**

* The attributes that are mass assignable.

*

* @var array

*/

public function index()

{

$users = DB::table('users')

->whereBetween('age',[21,30] )

->get();

dd($users);

}

It will help you...

#Laravel 7

#Laravel

#Laravel 6