37 lines
980 B
PHP
37 lines
980 B
PHP
<?php
|
|
|
|
namespace Modules\Countries\Console;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
class SyncIsoCountriesCommand extends Command
|
|
{
|
|
/** @var string */
|
|
protected $signature = 'countries:sync-iso {--subdivisions : Also seed bundled ISO 3166-2 subdivision data}';
|
|
|
|
/** @var string */
|
|
protected $description = 'Synchronise bundled ISO 3166 country reference data.';
|
|
|
|
/**
|
|
* Execute the command.
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
$this->call('db:seed', [
|
|
'--class' => 'Modules\\Countries\\Database\\Seeders\\IsoCountriesSeeder',
|
|
'--force' => true,
|
|
]);
|
|
|
|
if ($this->option('subdivisions')) {
|
|
$this->call('db:seed', [
|
|
'--class' => 'Modules\\Countries\\Database\\Seeders\\IsoCountrySubdivisionsSeeder',
|
|
'--force' => true,
|
|
]);
|
|
}
|
|
|
|
$this->components->info('ISO country reference data synchronised.');
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|