'decimal:2', 'price_yearly' => 'decimal:2', 'disk_gb' => 'integer', 'bandwidth_gb' => 'integer', 'cpu_cores' => 'integer', 'ram_mb' => 'integer', 'max_domains' => 'integer', 'max_databases' => 'integer', 'max_email_accounts' => 'integer', 'max_ftp_accounts' => 'integer', 'ssl_included' => 'boolean', 'backups_included' => 'boolean', 'backup_retention_days' => 'integer', 'features' => 'array', 'php_versions' => 'array', 'is_active' => 'boolean', 'is_featured' => 'boolean', 'sort_order' => 'integer', ]; public const TYPE_SHARED = 'shared'; public const TYPE_WORDPRESS = 'wordpress'; public const TYPE_VPS = 'vps'; public const TYPE_DEDICATED = 'dedicated'; public const TYPE_EMAIL = 'email'; public function accounts(): HasMany { return $this->hasMany(HostingAccount::class); } public function vpsInstances(): HasMany { return $this->hasMany(VpsInstance::class); } public function scopeActive($query) { return $query->where('is_active', true); } public function scopeOfType($query, string $type) { return $query->where('type', $type); } public function scopeFeatured($query) { return $query->where('is_featured', true); } public function scopeOrdered($query) { return $query->orderBy('sort_order')->orderBy('price_monthly'); } public function getYearlyDiscount(): ?float { if (!$this->price_yearly || !$this->price_monthly) { return null; } $monthlyTotal = $this->price_monthly * 12; return round((($monthlyTotal - $this->price_yearly) / $monthlyTotal) * 100, 1); } public function formatDiskSize(): string { if ($this->disk_gb >= 1000) { return round($this->disk_gb / 1000, 1) . ' TB'; } return $this->disk_gb . ' GB'; } public function formatRam(): string { if ($this->ram_mb >= 1024) { return round($this->ram_mb / 1024, 1) . ' GB'; } return $this->ram_mb . ' MB'; } }