You know you have to query last month’s records all the time (instead of the last 30 days). Here’s how to get those numbers easily with Carbon.
Carbon::now()->startofMonth()->subMonth();
Carbon::now()->startofMonth()->subMonth()->endOfMonth();
We do the extra fancy footwork for the end of the month to avoid simply getting the same last date of the month for the previous month.