2026-10-28 18:17:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
2026-10-28 18:45:03 +00:00
|
|
|
use App\Actions\SeedBarbarians;
|
2026-10-28 18:17:34 +00:00
|
|
|
use App\Models\World;
|
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
2026-10-28 18:45:03 +00:00
|
|
|
/** The default world and a fast dev world, with their barbarians. Safe to run on every deploy. */
|
2026-10-28 18:17:34 +00:00
|
|
|
class WorldSeeder extends Seeder
|
|
|
|
|
{
|
|
|
|
|
public function run(): void
|
|
|
|
|
{
|
2026-10-28 18:45:03 +00:00
|
|
|
$worlds = [
|
|
|
|
|
World::firstOrCreate(['slug' => 'w1'], ['name' => 'World 1', 'started_at' => now()]),
|
|
|
|
|
World::firstOrCreate(['slug' => 'dev'], [
|
|
|
|
|
'name' => 'Dev world',
|
|
|
|
|
'config' => ['world' => ['speed' => 100]],
|
|
|
|
|
'started_at' => now(),
|
|
|
|
|
]),
|
|
|
|
|
];
|
|
|
|
|
foreach ($worlds as $world) {
|
|
|
|
|
app(SeedBarbarians::class)($world);
|
|
|
|
|
}
|
2026-10-28 18:17:34 +00:00
|
|
|
}
|
|
|
|
|
}
|