Summary: - Baseline Compare landing: enterprise UI (stats grid, critical drift banner, better actions), navigation grouping under Governance, and Action Surface Contract declaration. - Baseline Profile view page: switches from disabled form fields to proper Infolist entries for a clean read-only view. - Fixes tenant name column usages (`display_name` → `name`) in baseline assignment flows. - Dashboard: improved baseline governance widget with severity breakdown + last compared. Notes: - Filament v5 / Livewire v4 compatible. - Destructive actions remain confirmed (`->requiresConfirmation()`). Tests: - `vendor/bin/sail artisan test --compact tests/Feature/Baselines` - `vendor/bin/sail artisan test --compact tests/Feature/Guards/ActionSurfaceContractTest.php` Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #123
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);
|
|
}
|
|
}
|