WhereBetween Query use in Laravel, Use WhereBetween Query use in Laravel 5.7, Eloquent WhereBetween Query use in Laravel 5.8,WhereBetween Query use in Laravel 5.6,WhereBetween Query use in Laravel 5.5,WhereBetween Query use in Laravel 5.4,WhereBetween Query use in Laravel 5.3,WhereBetween Query use in Laravel 5.2
Hello Friends today, I will tell you about whereBetween query method through this tutorial.
The whereBetween query method verifies that a column’s value is between two values.
whereBetween query method
$users = DB::table('users')->whereBetween('votes', [1, 50])->get();
Through the example I will try to understand you
$price1 = “1”;
$price2 = “50”;
$users = DB::table('users')->whereBetween('votes', [$price1, $price2])->get();
At first I created 2 variables. $ price1 and $ price2 and whose value is also defined. WhereBetween method query database will get the price of 1 to 50 and return it to the array format.