58 lines
1.2 KiB
PHP
58 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\DistributionModeEnum;
|
|
use App\Models\Traits\HasUuid;
|
|
use Database\Factories\ScenarioFactory;
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $uuid
|
|
* @property DistributionModeEnum $distribution_mode
|
|
* @property Collection<Bucket> $buckets
|
|
*
|
|
* @method static create(array $data)
|
|
*/
|
|
class Scenario extends Model
|
|
{
|
|
/** @use HasFactory<ScenarioFactory> */
|
|
use HasFactory, HasUuid;
|
|
|
|
protected $fillable = [
|
|
'name',
|
|
'description',
|
|
'distribution_mode',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'distribution_mode' => DistributionModeEnum::class,
|
|
];
|
|
}
|
|
|
|
public function buckets(): HasMany
|
|
{
|
|
return $this->hasMany(Bucket::class);
|
|
}
|
|
|
|
public function streams(): HasMany
|
|
{
|
|
return $this->hasMany(Stream::class);
|
|
}
|
|
|
|
public function inflows(): HasMany
|
|
{
|
|
return $this->hasMany(Inflow::class);
|
|
}
|
|
|
|
public function outflows(): HasMany
|
|
{
|
|
return $this->hasMany(Outflow::class);
|
|
}
|
|
}
|