I have a laravel project and in this project there is a table like this:
I need to run a query and return a result where the $circulation variable is in range of the column range_from and range_to.
So I tried this:
$tariff = StoreCategoryTariff::where('option_value', $side)
->whereBetween('range_from', [$circulation, 'range_to'])
->orWhereBetween('range_to', [$circulation, 'range_from'])
->first()->price;
But this is wrong..
I also tried this one:
$tariff = StoreCategoryTariff::where('option_value', $side)
->where('range_from', '>=', $circulation)
->where('range_from', '<=', $circulation)
->first()->price;
But didn’t get the result. So how to properly check for the result where circulation is in range ?
