presseportale/app/Services/CategoryService.php
Kevin Adametz 5b8bdf4182
Some checks are pending
linter / quality (push) Waiting to run
tests / ci (push) Waiting to run
12-05-2026 Frontend dev
2026-05-12 18:32:33 +02:00

213 lines
6.5 KiB
PHP

<?php
namespace App\Services;
class CategoryService
{
/**
* Alle verfügbaren Kategorien
*/
public static function getCategories(): array
{
return [
[
'name' => 'Wirtschaft',
'slug' => 'wirtschaft',
'description' => 'Unternehmensnachrichten, Finanzberichte, Wirtschaftstrends',
'count' => '2.450+',
'icon' => 'chart-bar',
'color' => 'blue',
],
[
'name' => 'Technologie',
'slug' => 'technologie',
'description' => 'IT, Software, Digitalisierung, Innovation',
'count' => '1.890+',
'icon' => 'cpu-chip',
'color' => 'purple',
],
[
'name' => 'Gesundheit',
'slug' => 'gesundheit',
'description' => 'Medizin, Pharma, Gesundheitswesen, Forschung',
'count' => '1.340+',
'icon' => 'heart',
'color' => 'green',
],
[
'name' => 'Finanzen',
'slug' => 'finanzen',
'description' => 'Banking, Investment, Fintech, Versicherungen',
'count' => '980+',
'icon' => 'currency-dollar',
'color' => 'yellow',
],
[
'name' => 'Automotive',
'slug' => 'automotive',
'description' => 'Fahrzeuge, E-Mobilität, Zulieferer, Logistik',
'count' => '750+',
'icon' => 'truck',
'color' => 'red',
],
[
'name' => 'Immobilien',
'slug' => 'immobilien',
'description' => 'Bau, Entwicklung, PropTech, Gewerbe',
'count' => '640+',
'icon' => 'building-office',
'color' => 'indigo',
],
[
'name' => 'Energie',
'slug' => 'energie',
'description' => 'Erneuerbare Energien, Strom, Gas, Nachhaltigkeit',
'count' => '520+',
'icon' => 'bolt',
'color' => 'orange',
],
[
'name' => 'Bildung',
'slug' => 'bildung',
'description' => 'Schulen, Universitäten, E-Learning, Weiterbildung',
'count' => '480+',
'icon' => 'academic-cap',
'color' => 'cyan',
],
[
'name' => 'Handel',
'slug' => 'handel',
'description' => 'Einzelhandel, E-Commerce, Konsumgüter',
'count' => '410+',
'icon' => 'shopping-cart',
'color' => 'pink',
],
[
'name' => 'Tourismus',
'slug' => 'tourismus',
'description' => 'Reisen, Hotellerie, Gastronomie, Veranstaltungen',
'count' => '390+',
'icon' => 'globe-alt',
'color' => 'teal',
],
[
'name' => 'Sport',
'slug' => 'sport',
'description' => 'Sportveranstaltungen, Vereine, Fitness, Sponsoring',
'count' => '320+',
'icon' => 'trophy',
'color' => 'lime',
],
[
'name' => 'Kultur',
'slug' => 'kultur',
'description' => 'Kunst, Musik, Theater, Medien, Entertainment',
'count' => '290+',
'icon' => 'musical-note',
'color' => 'violet',
],
];
}
/**
* Kategorie nach Slug finden
*/
public static function getCategoryBySlug(string $slug): ?array
{
$categories = self::getCategories();
foreach ($categories as $category) {
if ($category['slug'] === $slug) {
return $category;
}
}
return null;
}
/**
* Alle Kategorie-Slugs abrufen
*/
public static function getCategorySlugs(): array
{
return array_column(self::getCategories(), 'slug');
}
/**
* Farb-Gradient Mapping
*/
public static function getColorGradients(): array
{
return [
'blue' => 'from-blue-500/10 to-blue-600/10',
'purple' => 'from-purple-500/10 to-purple-600/10',
'green' => 'from-green-500/10 to-green-600/10',
'yellow' => 'from-yellow-500/10 to-yellow-600/10',
'red' => 'from-red-500/10 to-red-600/10',
'indigo' => 'from-indigo-500/10 to-indigo-600/10',
'orange' => 'from-orange-500/10 to-orange-600/10',
'cyan' => 'from-cyan-500/10 to-cyan-600/10',
'pink' => 'from-pink-500/10 to-pink-600/10',
'teal' => 'from-teal-500/10 to-teal-600/10',
'lime' => 'from-lime-500/10 to-lime-600/10',
'violet' => 'from-violet-500/10 to-violet-600/10',
];
}
/**
* Farb-Klassen Mapping
*/
public static function getColorClasses(): array
{
return [
'blue' => 'text-blue-500',
'purple' => 'text-purple-500',
'green' => 'text-green-500',
'yellow' => 'text-yellow-600',
'red' => 'text-red-500',
'indigo' => 'text-indigo-500',
'orange' => 'text-orange-500',
'cyan' => 'text-cyan-500',
'pink' => 'text-pink-500',
'teal' => 'text-teal-500',
'lime' => 'text-lime-500',
'violet' => 'text-violet-500',
];
}
/**
* Gradient für eine Farbe abrufen
*/
public static function getGradientForColor(string $color): string
{
$gradients = self::getColorGradients();
return $gradients[$color] ?? 'from-gray-500/10 to-gray-600/10';
}
/**
* CSS-Klasse für eine Farbe abrufen
*/
public static function getClassForColor(string $color): string
{
$classes = self::getColorClasses();
return $classes[$color] ?? 'text-gray-500';
}
/**
* Icon-Pfad für eine Kategorie generieren
*/
public static function getIconPath(string $iconName): string
{
return "/heroicons/optimized/24/outline/{$iconName}.svg";
}
/**
* Gesamtanzahl der Kategorien
*/
public static function count(): int
{
return count(self::getCategories());
}
}