- Fix EventType deletion error handling (constraint violations) - Fix Event update error (package_id column missing) - Fix Event Type dropdown options (JSON display issue) - Fix EventPackagesRelationManager query error - Add missing translations for deletion errors - Apply Pint formatting
41 lines
2.7 KiB
PHP
41 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Emotion;
|
|
use App\Models\EventType;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
class EmotionsSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$emotionData = [
|
|
['name' => ['de' => 'Liebe', 'en' => 'Love'], 'icon' => '💖', 'color' => '#ff6b9d', 'description' => ['de' => 'Romantische Momente', 'en' => 'Romantic moments'], 'sort_order' => 1],
|
|
['name' => ['de' => 'Freude', 'en' => 'Joy'], 'icon' => '😊', 'color' => '#ffd93d', 'description' => ['de' => 'Fröhliche Augenblicke', 'en' => 'Happy moments'], 'sort_order' => 2],
|
|
['name' => ['de' => 'Rührung', 'en' => 'Touched'], 'icon' => '🥹', 'color' => '#6bcf7f', 'description' => ['de' => 'Berührende Szenen', 'en' => 'Touching scenes'], 'sort_order' => 3],
|
|
['name' => ['de' => 'Nostalgie', 'en' => 'Nostalgia'], 'icon' => '🕰️', 'color' => '#a78bfa', 'description' => ['de' => 'Erinnerungen', 'en' => 'Memories'], 'sort_order' => 4],
|
|
['name' => ['de' => 'Überraschung', 'en' => 'Surprise'], 'icon' => '😲', 'color' => '#fb7185', 'description' => ['de' => 'Unerwartete Momente', 'en' => 'Unexpected moments'], 'sort_order' => 5],
|
|
['name' => ['de' => 'Stolz', 'en' => 'Pride'], 'icon' => '🏆', 'color' => '#34d399', 'description' => ['de' => 'Triumphale Augenblicke', 'en' => 'Triumphal moments'], 'sort_order' => 6],
|
|
['name' => ['de' => 'Teamgeist', 'en' => 'Team Spirit'], 'icon' => '🤝', 'color' => '#38bdf8', 'description' => ['de' => 'Zusammenhalt', 'en' => 'Team bonding'], 'sort_order' => 7],
|
|
['name' => ['de' => 'Besinnlichkeit', 'en' => 'Contemplation'], 'icon' => '🕯️', 'color' => '#22c55e', 'description' => ['de' => 'Feierliche Stimmung', 'en' => 'Festive calm'], 'sort_order' => 8],
|
|
['name' => ['de' => 'Romantik', 'en' => 'Romance'], 'icon' => '🌹', 'color' => '#e11d48', 'description' => ['de' => 'Romantische Stimmung', 'en' => 'Romantic mood'], 'sort_order' => 9],
|
|
['name' => ['de' => 'Ekstase', 'en' => 'Ecstasy'], 'icon' => '🎉', 'color' => '#f59e0b', 'description' => ['de' => 'Pure Lebensfreude', 'en' => 'Pure zest for life'], 'sort_order' => 10],
|
|
];
|
|
|
|
$typeIds = EventType::pluck('id')->toArray();
|
|
|
|
foreach ($emotionData as $e) {
|
|
$emotion = Emotion::updateOrCreate(['name->de' => $e['name']['de']], $e);
|
|
// Link to all event types
|
|
foreach ($typeIds as $typeId) {
|
|
DB::table('emotion_event_type')->updateOrInsert([
|
|
'emotion_id' => $emotion->id,
|
|
'event_type_id' => $typeId,
|
|
], []);
|
|
}
|
|
}
|
|
}
|
|
}
|