api/database/seeders/BordeauxHuntsSeeder.php

72 lines
2.4 KiB
PHP

<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class BordeauxHuntsSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
// 1. Create an organizer user (creator)
$creator = \App\Models\User::factory()->create([
'username' => 'Bordeaux Organizer',
'email' => 'orga@bordeaux.fr',
'password' => bcrypt('password'),
'role' => \App\Enums\UserRole::ORGA,
]);
// 2. Create Hunts in Bordeaux
$hunts = \App\Models\Hunts::factory()->count(3)->create([
'creator_id' => $creator->id,
'city' => 'Bordeaux',
'latitude' => 44.837789,
'longitude' => -0.57918,
'status' => \App\Enums\HuntStatus::PUBLISHED,
]);
// 3. Create Steps for each Hunt
foreach ($hunts as $hunt) {
// Step 1: Place de la Bourse
\App\Models\HuntSteps::factory()->create([
'hunt_id' => $hunt->id,
'step_number' => 1,
'title' => 'Place de la Bourse',
'description' => 'Rendez-vous sur cette place emblématique.',
'hint_text' => 'Miroir d\'eau',
'latitude' => 44.8417,
'longitude' => -0.5706,
'radius_m' => 50,
]);
// Step 2: Grand Théâtre
\App\Models\HuntSteps::factory()->create([
'hunt_id' => $hunt->id,
'step_number' => 2,
'title' => 'Grand Théâtre',
'description' => 'Un opéra du XVIIIe siècle.',
'hint_text' => 'Douze colonnes corinthiennes',
'latitude' => 44.8427,
'longitude' => -0.5746,
'radius_m' => 50,
]);
// Step 3: Cathédrale Saint-André
\App\Models\HuntSteps::factory()->create([
'hunt_id' => $hunt->id,
'step_number' => 3,
'title' => 'Cathédrale Saint-André',
'description' => 'Le plus beau monument religieux de Bordeaux.',
'hint_text' => 'Tour Pey Berland',
'latitude' => 44.8378,
'longitude' => -0.5775,
'radius_m' => 50,
]);
}
}
}