diff --git a/README.md b/README.md index 5601896..c81cda0 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,7 @@ LaravelMetrics::query( ->byDay($count = 0) ->byMonth($count = 0) ->byYear($count = 0) +->by($period, $count = 0) ->between($startDate, $endDate) ``` @@ -77,6 +78,7 @@ LaravelMetrics::query( $count = 0 => for every day, month or year $count = 1 => for the current day, month or year $count > 1 => for an interval of day, month or year from the $count value to now +$period = 'day', 'month' or 'year' ``` ### Types of aggregates diff --git a/src/Exceptions/InvalidPeriodException.php b/src/Exceptions/InvalidPeriodException.php new file mode 100644 index 0000000..9e672a4 --- /dev/null +++ b/src/Exceptions/InvalidPeriodException.php @@ -0,0 +1,16 @@ +period = $period; + $this->count = $count; + return $this; + } + public function between(string $start, string $end): self { $this->checkDateFormat([$start, $end]);