29 lines
819 B
PHP
29 lines
819 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Actions\SeedBarbarians;
|
|
use App\Models\World;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
/** The default world and a fast dev world, with their barbarians. Safe to run on every deploy. */
|
|
class WorldSeeder extends Seeder
|
|
{
|
|
public function run(): void
|
|
{
|
|
$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(),
|
|
]),
|
|
];
|
|
$barbarians = app(SeedBarbarians::class);
|
|
foreach ($worlds as $world) {
|
|
$barbarians($world);
|
|
$barbarians->scheduleGrowth($world);
|
|
}
|
|
}
|
|
}
|