33 lines
778 B
PHP
33 lines
778 B
PHP
<?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');
|
|
}
|
|
}
|