diff --git a/src/Command/InstallLunarCommand.php b/src/Command/InstallLunarCommand.php index ba98084..f74b925 100644 --- a/src/Command/InstallLunarCommand.php +++ b/src/Command/InstallLunarCommand.php @@ -22,19 +22,24 @@ use Lunar\Models\TaxZone; /** * Overrides Lunar's own lunar:install to skip the interactive prompts (migrate * confirmation, admin creation, GitHub star), so it's safe to run unattended from - * the entrypoint on every boot. Migrations and address-data import already run as - * separate, earlier entrypoint steps; the admin user is created manually. + * the entrypoint on every boot. Migrations already run as a separate, earlier + * entrypoint step; the admin user is created manually. */ class InstallLunarCommand extends Command { protected $signature = 'lunar:install'; - protected $description = 'Seed the default Lunar store data (channel, currency, tax zone, attributes, product type)'; + protected $description = 'Seed the default Lunar store data (countries, channel, currency, tax zone, attributes, product type)'; public function handle(): void { $this->components->info('Seeding default Lunar store data...'); + if (! Country::count()) { + $this->components->info('Importing countries'); + $this->call('lunar:import:address-data'); + } + DB::transaction(function () { if (! Channel::whereDefault(true)->exists()) { $this->components->info('Setting up default channel');