i have a for loop that i am using a query in it , but when i try to get the data it only shows me the last time that query have been running like below :
for ($i = 0; $i < count($dates); $i++) {
for ($f = 0; $f < count($room_ids); $f++) {
/****************************************
* Looping for the Number of Rooms User Given
*****************************************/
$room_price = RoomPrice::with('Room')
->where('room_id', $room_ids[$f])
->whereDate('from_date', '<=', $dates[$i])
->whereDate('to_date', '>=', $dates[$i])
->get()->sortBy('created_at');
}
}
how can i store $room_price so i can have all the data that every time query runned will be stored in a collection or something . thanks