Добавил базовые датасеты и агрегации для конструктора отчетов
This commit is contained in:
33
app/Services/Analytics/Column.php
Normal file
33
app/Services/Analytics/Column.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Analytics;
|
||||
|
||||
/**
|
||||
* Колонка результата отчёта (для таблицы и графика).
|
||||
*/
|
||||
readonly class Column
|
||||
{
|
||||
/**
|
||||
* @param 'dimension'|'measure'|'period' $kind
|
||||
* @param 'string'|'date'|'number'|'money'|'percent' $type
|
||||
*/
|
||||
public function __construct(
|
||||
public string $key,
|
||||
public string $label,
|
||||
public string $kind,
|
||||
public string $type,
|
||||
public ?string $unit = null,
|
||||
) {}
|
||||
|
||||
/** @return array<string,mixed> */
|
||||
public function toArray(): array
|
||||
{
|
||||
return [
|
||||
'key' => $this->key,
|
||||
'label' => $this->label,
|
||||
'kind' => $this->kind,
|
||||
'type' => $this->type,
|
||||
'unit' => $this->unit,
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user