Add countries and regions
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('continents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('code', 2)->unique();
|
||||
$table->string('name');
|
||||
$table->string('internal_name');
|
||||
});
|
||||
|
||||
DB::table('continents')->insert($this->continents());
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('continents');
|
||||
}
|
||||
|
||||
private function continents(): array
|
||||
{
|
||||
|
||||
return [
|
||||
['code' => 'AF', 'name' => 'Africa', 'internal_name' => 'africa', ],
|
||||
['code' => 'AN', 'name' => 'Antarctica', 'internal_name' => 'antarctica', ],
|
||||
['code' => 'AS', 'name' => 'Asia', 'internal_name' => 'asia', ],
|
||||
['code' => 'EU', 'name' => 'Europe', 'internal_name' => 'europe', ],
|
||||
['code' => 'NA', 'name' => 'North America', 'internal_name' => 'north_america', ],
|
||||
['code' => 'OC', 'name' => 'Oceania', 'internal_name' => 'oceania', ],
|
||||
['code' => 'SA', 'name' => 'South America', 'internal_name' => 'south_america',],
|
||||
];
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user