Модели для конструктора отчетов

This commit is contained in:
brusnitsyn
2026-06-22 16:58:50 +09:00
parent e646ded338
commit 71bd4b9d1a
6 changed files with 174 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* Пользовательский показатель: производный от базового показателя датасета
* (другой агрегат или процент/множитель), без свободного ввода SQL.
*/
class CustomMeasure extends Model
{
protected $fillable = [
'name',
'dataset',
'base_measure',
'aggregate',
'factor',
'unit',
'created_by',
];
protected $casts = [
'factor' => 'float',
];
public function creator(): BelongsTo
{
return $this->belongsTo(User::class, 'created_by');
}
}