1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-20 08:21:34 +02:00
invoiceninja/database/seeds/CountriesSeeder.php

37 lines
1.5 KiB
PHP
Raw Normal View History

2015-03-16 22:45:25 +01:00
<?php
use Illuminate\Database\Eloquent\Model as Eloquent;
class CountriesSeeder extends Seeder {
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
//Empty the countries table
DB::table('countries')->delete();
//Get all of the countries
$countries = Countries::getList();
foreach ($countries as $countryId => $country){
DB::table('countries')->insert(array(
'id' => $countryId,
'capital' => ((isset($country['capital'])) ? $country['capital'] : null),
'citizenship' => ((isset($country['citizenship'])) ? $country['citizenship'] : null),
'country_code' => $country['country-code'],
'currency' => ((isset($country['currency'])) ? $country['currency'] : null),
'currency_code' => ((isset($country['currency_code'])) ? $country['currency_code'] : null),
'currency_sub_unit' => ((isset($country['currency_sub_unit'])) ? $country['currency_sub_unit'] : null),
'full_name' => ((isset($country['full_name'])) ? $country['full_name'] : null),
'iso_3166_2' => $country['iso_3166_2'],
'iso_3166_3' => $country['iso_3166_3'],
'name' => $country['name'],
'region_code' => $country['region-code'],
'sub_region_code' => $country['sub-region-code'],
'eea' => (bool)$country['eea']
));
}
}
}