'array', 'monthly_amount' => 'integer', 'annual_amount' => 'integer', 'sort_order' => 'integer', 'is_featured' => 'boolean', 'is_active' => 'boolean', ]; /** * Scope prices into display order. */ public function scopeOrdered(Builder $query): Builder { return $query->orderBy('sort_order')->orderBy('name'); } /** * Return the display currency symbol. */ public function currencySymbol(): string { return match (strtolower($this->currency)) { 'gbp' => '£', 'eur' => '€', 'usd' => '$', default => strtoupper($this->currency).' ', }; } /** * Format a stored minor-unit amount for display. */ public function formatAmount(?int $amount): string { if ($amount === null) { return '—'; } return $this->currencySymbol().number_format($amount / 100, 2); } /** * Return normalised feature rows. * * @return array */ public function featureRows(): array { return collect($this->features ?? []) ->filter(fn ($feature): bool => is_string($feature) && trim($feature) !== '') ->map(fn (string $feature): string => trim($feature)) ->values() ->all(); } }