public static function perMonth($months = 1, $date_format = "Y-m")
    {
        
        $hits_per_month = [];

        for ($i = 1; $i <= $months; $i++) {
            $hits_count = self::interval(Carbon::now()->subMonths($i)->firstOfMonth(), Carbon::now()->subMonths($i)->lastOfMonth());

            $hits_per_month[Carbon::now()->subMonths($i)->format($date_format)] = $hits_count;
        }

        return $hits_per_month;

    }
public static function perMonth($months = 1, $date_format = "Y-m")
    {
        
        $hits_per_month = [];

        for ($i = 1; $i <= $months; $i++) {
            $hits_count = self::interval(Carbon::now()->subMonths($i)->firstOfMonth(), Carbon::now()->subMonths($i)->lastOfMonth());

            $hits_per_month[Carbon::now()->subMonths($i)->format($date_format)] = $hits_count;
        }

        return $hits_per_month;

    }
Returns an associative array the keys are the names of the months and the
values are the number of hits during this month. If no parameter is
provided then the method returns the hits for the last month.

@param int $months
@param string $date_format
@return array