feat(form-builder): form_field_configs relational table + non-validation key split + drop validation_rules JSON columns

This commit is contained in:
2026-04-24 22:42:35 +02:00
parent 9d2758a42c
commit d494478c08
31 changed files with 1233 additions and 60 deletions

View File

@@ -0,0 +1,52 @@
<?php
declare(strict_types=1);
namespace App\Models\FormBuilder;
use App\Enums\FormBuilder\FormFieldConfigType;
use App\Models\Scopes\FormFieldConfigScope;
use Illuminate\Database\Eloquent\Concerns\HasUlids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphTo;
/**
* Relational home for non-validation field configuration. See
* ARCH-FORM-BUILDER §17.5 and ARCH-CONSOLIDATION-ADDENDUM-2026-04-24
* §Q3 WS-5b Uitvoering.
*
* Polymorphic owner (`form_field` / `form_field_library` aliases, reused
* from WS-5a). One row per (owner, config_type). Parameter shape
* validated at the service layer.
*/
final class FormFieldConfig extends Model
{
use HasFactory;
use HasUlids;
protected $table = 'form_field_configs';
protected static function booted(): void
{
static::addGlobalScope(new FormFieldConfigScope());
}
protected $fillable = [
'owner_type',
'owner_id',
'config_type',
'parameters',
];
/** @var array<string, string> */
protected $casts = [
'config_type' => FormFieldConfigType::class,
'parameters' => 'array',
];
public function owner(): MorphTo
{
return $this->morphTo('owner', 'owner_type', 'owner_id');
}
}