feat: Refactor addon management to use AddonType and AddonInputType enums, update the database schema, and implement a grouped datatable display for addons.

This commit is contained in:
pbao9
2026-02-13 11:31:54 +07:00
parent b127fa7c66
commit 245f5ade37
11 changed files with 684 additions and 216 deletions
+28
View File
@@ -0,0 +1,28 @@
<?php
namespace App\Enums;
enum AddonInputType: string
{
case NUMBER = 'number';
case SLIDER = 'slider';
case SELECT = 'select';
public function label(): string
{
return match ($this) {
self::NUMBER => 'Số',
self::SLIDER => 'Thanh trượt',
self::SELECT => 'Chọn',
};
}
public static function getOptions(): array
{
return [
self::NUMBER->value => self::NUMBER->label(),
self::SLIDER->value => self::SLIDER->label(),
self::SELECT->value => self::SELECT->label(),
];
}
}
+33
View File
@@ -0,0 +1,33 @@
<?php
namespace App\Enums;
enum AddonType: string
{
case VPS = 'vps';
case HOSTING = 'hosting';
case DOMAIN = 'domain';
public function label(): string
{
return match ($this) {
self::VPS => 'VPS',
self::HOSTING => 'Hosting',
self::DOMAIN => 'Domain',
};
}
public static function getOptions(): array
{
return [
self::VPS->value => self::VPS->label(),
self::HOSTING->value => self::HOSTING->label(),
self::DOMAIN->value => self::DOMAIN->label(),
];
}
public static function values(): array
{
return array_column(self::cases(), 'value');
}
}