72 lines
2.0 KiB
PHP
72 lines
2.0 KiB
PHP
<?php
|
|
|
|
namespace App\Enums\WebDesign;
|
|
|
|
enum WebDesignPlatform: string
|
|
{
|
|
case WORDPRESS_ELEMENTOR = 'wordpress_elementor';
|
|
case WORDPRESS_HEADLESS = 'wordpress_headless';
|
|
case LARAVEL = 'laravel';
|
|
case NESTJS = 'nestjs';
|
|
case SPRING_BOOT = 'spring_boot';
|
|
|
|
public function label(): string
|
|
{
|
|
return match ($this) {
|
|
self::WORDPRESS_ELEMENTOR => 'WordPress + Elementor',
|
|
self::WORDPRESS_HEADLESS => 'WordPress Headless',
|
|
self::LARAVEL => 'Laravel',
|
|
self::NESTJS => 'NestJS',
|
|
self::SPRING_BOOT => 'Spring Boot',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Các framework frontend cho phép theo từng nền tảng.
|
|
* Mảng rỗng = không có lựa chọn frontend riêng.
|
|
*/
|
|
public function frontendOptions(): array
|
|
{
|
|
return match ($this) {
|
|
self::WORDPRESS_ELEMENTOR => [],
|
|
self::WORDPRESS_HEADLESS => ['nextjs', 'astro', 'vue', 'react', 'nuxt', 'angular'],
|
|
self::LARAVEL, self::NESTJS => ['react', 'nextjs', 'nuxt', 'vue'],
|
|
self::SPRING_BOOT => ['react', 'nextjs', 'nuxt', 'vue', 'angular'],
|
|
};
|
|
}
|
|
|
|
public function defaultFrontend(): ?string
|
|
{
|
|
return match ($this) {
|
|
self::WORDPRESS_ELEMENTOR => null,
|
|
self::WORDPRESS_HEADLESS => 'nextjs',
|
|
self::LARAVEL, self::NESTJS => 'react',
|
|
self::SPRING_BOOT => 'react',
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Từ gói Laravel trở lên có thể custom admin.
|
|
*/
|
|
public function supportsCustomAdmin(): bool
|
|
{
|
|
return match ($this) {
|
|
self::WORDPRESS_ELEMENTOR, self::WORDPRESS_HEADLESS => false,
|
|
self::LARAVEL, self::NESTJS, self::SPRING_BOOT => true,
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Phụ phí bản quyền hằng năm theo USD (Elementor Pro).
|
|
*/
|
|
public function annualLicenseFeeUsd(): int
|
|
{
|
|
return $this === self::WORDPRESS_ELEMENTOR ? 60 : 0;
|
|
}
|
|
|
|
public static function values(): array
|
|
{
|
|
return array_column(self::cases(), 'value');
|
|
}
|
|
}
|