
Today now in this example,I will share with you how to use where between query in laravel application.we can simple use the where between query in our laravel application.
For example,we will get to user table age but need to user age get 21 to 30 in table then we can use to where between query in your controller.
We can also get the records from where between two date and also age. So here i give you the both of example are bellow. Just you need to follow 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); }
Read Also : Laravel 8 Eloquent Global Scope Tutorial Example
I hope it will help you. Also you can follow us on Facebook