🌍 Add city creation modal and country migration command

This commit is contained in:
HolgerHatGarKeineNode
2025-11-21 13:35:29 +01:00
parent 69e46fabce
commit 976844487a
2 changed files with 140 additions and 5 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands\Database;
use App\Models\Country;
use Illuminate\Console\Command;
class MigrateCountriesTableCommand extends Command
{
protected $signature = 'database:migrate-countries-table';
protected $description = 'Migrate countries table by creating new entries from iso codes';
public function handle(): void
{
$this->output->progressStart(\WW\Countries\Models\Country::count());
foreach (\WW\Countries\Models\Country::all() as $country) {
Country::query()
->updateOrCreate(
['code' => str($country->iso_code)->lower()],
[
'name' => $country->name,
'english_name' => $country->name,
],
);
$this->output->progressAdvance();
}
$this->output->progressFinish();
$this->info('🌍 Countries migrated successfully! 🎉');
}
}