Open bdpsoft opened 7 months ago
You can replace in aggregate this line ->groupBy(DB::raw($this->getSqlDate())) // ->groupBy($this->dateAlias)
->groupBy(DB::raw($this->getSqlDate())) // ->groupBy($this->dateAlias)
and add Adapter for sqlsrv
class MssqlAdapter extends AbstractAdapter { public function format(string $column, string $interval): string { $format = match ($interval) { 'minute' => 'yyyy-MM-dd HH:mm:00', 'hour' => 'yyyy-MM-dd HH:00:00', 'day' => 'yyyy-MM-dd', 'month' => 'yyyy-MM', 'year' => 'yyyy', default => throw new Error('Invalid interval.'), };
return "format({$column}, '{$format}')"; }
}
You can replace in aggregate this line
->groupBy(DB::raw($this->getSqlDate())) // ->groupBy($this->dateAlias)
and add Adapter for sqlsrv
class MssqlAdapter extends AbstractAdapter { public function format(string $column, string $interval): string { $format = match ($interval) { 'minute' => 'yyyy-MM-dd HH:mm:00', 'hour' => 'yyyy-MM-dd HH:00:00', 'day' => 'yyyy-MM-dd', 'month' => 'yyyy-MM', 'year' => 'yyyy', default => throw new Error('Invalid interval.'), };
}