i am looping whole month using for loop
for ($i = 1; $i < $days; $i++) {
$date = now()->format('Y-m-') . $i; //result '2020-08-1'
$date = Carbon::parse($date); //parsing with carbon
$profit = Profit::whereDate('created_at', $date->format('Y-m-d'))->first(); //<-- this not working getting null data
$data[] = $profit;
}
but this working
$profit = Profit::whereDate('created_at', '2020-08-01')->first(); //<-- its working fine statically
what i am doing wrong help me thank you