Beispieldatensätze eingefügt
This commit is contained in:
parent
b48a9ce656
commit
5b922414e0
@ -15,11 +15,8 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// User::factory(10)->create();
|
||||
|
||||
User::factory()->create([
|
||||
'name' => 'Test User',
|
||||
'email' => 'test@example.com',
|
||||
$this->call([
|
||||
EventSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
131
database/seeders/EventSeeder.php
Normal file
131
database/seeders/EventSeeder.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Event;
|
||||
use App\Models\EventOccurrence;
|
||||
use App\Models\Source;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class EventSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Source erstellen
|
||||
$source = Source::firstOrCreate(['name' => 'Demo Source']);
|
||||
|
||||
$events = [
|
||||
[
|
||||
'title' => 'Jazz-Konzert im Park',
|
||||
'description' => 'Ein wunderschönes Jazz-Konzert mit bekannten Künstlern unter freiem Himmel. Genießen Sie klassischen Jazz bei schönem Wetter.',
|
||||
'location' => 'Berlin, Tiergarten',
|
||||
'category' => 'Musik',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Kunstausstellung "Modern Wonders"',
|
||||
'description' => 'Zeitgenössische Kunstwerke von internationalen Künstlern. Eine Reise durch moderne Kunstrichtungen.',
|
||||
'location' => 'München, Kunsthalle',
|
||||
'category' => 'Kunst',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Marathon 2026',
|
||||
'description' => 'Halbmarathon durch die Stadt. Meldung erforderlich. Für verschiedene Leistungsstufen geeignet.',
|
||||
'location' => 'Hamburg, Stadtzentrum',
|
||||
'category' => 'Sport',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Film-Festival "Indie Nights"',
|
||||
'description' => 'Die besten Independentfilme des Jahres. Entdecken Sie neue Talente im internationalen Kino.',
|
||||
'location' => 'Köln, Cinemaxx',
|
||||
'category' => 'Film',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Technologie-Konferenz 2026',
|
||||
'description' => 'Die neuesten Trends in AI und Cloud Computing. Vorträge von Experten und Networking-Sessions.',
|
||||
'location' => 'Frankfurt, Convention Center',
|
||||
'category' => 'Technologie',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Theaterstück: "Der Traum"',
|
||||
'description' => 'Eine klassische Theaterproduktion in moderner Inszenierung. Ein Muss für Theaterliebhaber.',
|
||||
'location' => 'Stuttgart, Staatstheater',
|
||||
'category' => 'Theater',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Sommerfest Altstadt',
|
||||
'description' => 'Traditionelles Volksfest mit Musik, Essen und Unterhaltung für die ganze Familie.',
|
||||
'location' => 'Nürnberg, Altstadt',
|
||||
'category' => 'Festival',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Yoga und Meditation Workshop',
|
||||
'description' => 'Kostenloser Workshop für Anfänger und Fortgeschrittene. Bitte Matte mitbringen.',
|
||||
'location' => 'Düsseldorf, Stadtpark',
|
||||
'category' => 'Wellness',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Buchlesung: "Das Erbe"',
|
||||
'description' => 'Die Autorin liest aus ihrem neuen Roman. Anschließend Signieren und Austausch mit Lesern.',
|
||||
'location' => 'Leipzig, Stadtbibliothek',
|
||||
'category' => 'Literatur',
|
||||
'image_url' => null,
|
||||
],
|
||||
[
|
||||
'title' => 'Kochkurs "Italienische Küche"',
|
||||
'description' => 'Lernen Sie authentische italienische Gerichte von einem Proffikoch. Inkl. Verkostung.',
|
||||
'location' => 'Dresden, Kochschule Meyer',
|
||||
'category' => 'Kulinarik',
|
||||
'image_url' => null,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($events as $eventData) {
|
||||
$event = Event::create([
|
||||
'source_id' => $source->id,
|
||||
'title' => $eventData['title'],
|
||||
'description' => $eventData['description'],
|
||||
'location' => $eventData['location'],
|
||||
'category' => $eventData['category'],
|
||||
'slug' => \Illuminate\Support\Str::slug($eventData['title']),
|
||||
'image_url' => $eventData['image_url'],
|
||||
'status' => 'published',
|
||||
]);
|
||||
|
||||
// Erste Termin
|
||||
EventOccurrence::create([
|
||||
'event_id' => $event->id,
|
||||
'start_datetime' => Carbon::now()->addDays(rand(5, 15))->setHour(rand(14, 19))->setMinute(0),
|
||||
'end_datetime' => Carbon::now()->addDays(rand(5, 15))->setHour(rand(20, 23))->setMinute(0),
|
||||
'status' => 'scheduled',
|
||||
]);
|
||||
|
||||
// Zweiter Termin
|
||||
EventOccurrence::create([
|
||||
'event_id' => $event->id,
|
||||
'start_datetime' => Carbon::now()->addDays(rand(20, 40))->setHour(rand(14, 19))->setMinute(0),
|
||||
'end_datetime' => Carbon::now()->addDays(rand(20, 40))->setHour(rand(20, 23))->setMinute(0),
|
||||
'status' => 'scheduled',
|
||||
]);
|
||||
|
||||
// Dritter Termin
|
||||
EventOccurrence::create([
|
||||
'event_id' => $event->id,
|
||||
'start_datetime' => Carbon::now()->addDays(rand(45, 90))->setHour(rand(14, 19))->setMinute(0),
|
||||
'end_datetime' => Carbon::now()->addDays(rand(45, 90))->setHour(rand(20, 23))->setMinute(0),
|
||||
'status' => 'scheduled',
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user