Level 4
What kind of database are you using? And can you confirm the layout of your database? Do you have two columns named 'fromDate' and 'toDate'?
If the column is set to the date type, then you should be able to use:
$formattedFromDate = $newFromDate->format('Y-m-d');
$formattedToDate = $newToDate->format('Y-m-d');
$query->whereBetween('date', [$formattedFromDate, $formattedToDate]);
This is assuming you have a column in your database called date.