I am beginner with mysql and PHP Larvel. I have a query thats says
Sale::whereDate('created_at', '>=' , $startDate)
->whereDate('created_at', '<=' , $endDate)
->where('company_id',$companyId)
->selectRaw(implode(',', $query))
->get();
The query below returns data for January since the startDate is ‘2022-01-01’ and endDate is ‘2022-01-31’
But when i do same for February, it returns null because there is no 2022-02-31 in reality. But when i set the endDate to ‘2022-02-29’, it returns data.
How can i make my query still bring data even tho 2022-02-31 does not exist on calendar ?