Refactor Prop model to use enum for data types; remove PropDataType model and update related requests and migrations

This commit is contained in:
2026-06-22 13:13:22 -03:00
parent 7075704dad
commit 55694b2048
12 changed files with 454 additions and 70 deletions

View File

@@ -0,0 +1,26 @@
<?php
namespace App\Domains\Prop\Support;
enum PropDataType: string
{
case String = 'string';
case Integer = 'integer';
case Decimal = 'decimal';
case Boolean = 'boolean';
case Date = 'date';
case DateTime = 'datetime';
case Json = 'json';
case Select = 'select';
/**
* @return list<string>
*/
public static function values(): array
{
return array_map(
static fn (self $type): string => $type->value,
self::cases(),
);
}
}

View File

@@ -39,4 +39,9 @@ class PropableModels
return $modelClass;
}
public static function aliasFor(string $modelClass): ?string
{
return array_search($modelClass, static::map(), true) ?: null;
}
}