diff --git a/src/Command/Migrate.php b/src/Command/Migrate.php index 8e34068..434e768 100644 --- a/src/Command/Migrate.php +++ b/src/Command/Migrate.php @@ -118,6 +118,66 @@ class Migrate extends Command ] ); } + if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Netherlands')->exists()) { + Capsule::table('countries')->insert([ + 'countryName' => 'Netherlands', + 'productsUrl' => 'https://nl.ryobitools.eu/api/product-listing/get-products', + 'cultureCode' => 'nl-NL', + 'currency' => 'EUR', + 'locale' => 'nl', + 'created_at' => now(), + 'updated_at' => now(), + ] + ); + } + if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'France')->exists()) { + Capsule::table('countries')->insert([ + 'countryName' => 'France', + 'productsUrl' => 'https://fr.ryobitools.eu/api/product-listing/get-products', + 'cultureCode' => 'fr-FR', + 'currency' => 'EUR', + 'locale' => 'fr', + 'created_at' => now(), + 'updated_at' => now(), + ] + ); + } + if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Spain')->exists()) { + Capsule::table('countries')->insert([ + 'countryName' => 'Spain', + 'productsUrl' => 'https://es.ryobitools.eu/api/product-listing/get-products', + 'cultureCode' => 'es-ES', + 'currency' => 'EUR', + 'locale' => 'es', + 'created_at' => now(), + 'updated_at' => now(), + ] + ); + } + if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'Poland')->exists()) { + $id = Capsule::table('countries')->insertGetId( + [ + 'countryName' => 'Poland', + 'productsUrl' => 'https://pl.ryobitools.eu/api/product-listing/get-products', + 'cultureCode' => 'pl-PL', + 'currency' => 'PLN', + 'locale' => 'pl', + 'created_at' => now(), + 'updated_at' => now(), + ]); + } + if (Capsule::schema()->hasTable('countries') && !Country::where('countryName', 'UK')->exists()) { + Capsule::table('countries')->insert([ + 'countryName' => 'UK', + 'productsUrl' => 'https://uk.ryobitools.eu/api/product-listing/get-products', + 'cultureCode' => 'en-GB', + 'currency' => 'GBP', + 'locale' => 'uk', + 'created_at' => now(), + 'updated_at' => now(), + ] + ); + } if (!Capsule::schema()->hasColumn('products', 'country_id')) { Capsule::schema()->table('products', function (Blueprint $table) use ($id) {