T003-T018b: Add workspace_baselines.view/manage capabilities, role mappings, baseline_capture/baseline_compare operation labels, severity summary keys, 5 migrations, 4 models, 4 factories, BaselineScope, BaselineReasonCodes, BaselineProfileStatus badge domain + mapper.
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class BaselineProfile extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const string STATUS_DRAFT = 'draft';
|
|
|
|
public const string STATUS_ACTIVE = 'active';
|
|
|
|
public const string STATUS_ARCHIVED = 'archived';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'scope_jsonb' => 'array',
|
|
];
|
|
|
|
public function workspace(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Workspace::class);
|
|
}
|
|
|
|
public function createdByUser(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by_user_id');
|
|
}
|
|
|
|
public function activeSnapshot(): BelongsTo
|
|
{
|
|
return $this->belongsTo(BaselineSnapshot::class, 'active_snapshot_id');
|
|
}
|
|
|
|
public function snapshots(): HasMany
|
|
{
|
|
return $this->hasMany(BaselineSnapshot::class);
|
|
}
|
|
|
|
public function tenantAssignments(): HasMany
|
|
{
|
|
return $this->hasMany(BaselineTenantAssignment::class);
|
|
}
|
|
}
|