diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/README.md b/README.md index 0defe6b..98377a7 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,6 @@ Add `webpatser/laravel-countries` to `composer.json`. Run `composer update` to pull down the latest version of Country List. -**If you're using Laravel 5.5, you don't have to edit `app/config/app.php`.** - Edit `app/config/app.php` and add the `provider` and `filter` 'providers' => [ @@ -40,7 +38,6 @@ You can start by publishing the configuration. This is an optional step, it cont Next generate the migration file: $ php artisan countries:migration - $ composer dump-autoload It will generate the `_setup_countries_table.php` migration and the `CountriesSeeder.php` seeder. To make sure the data is seeded insert the following code in the `seeds/DatabaseSeeder.php` @@ -52,4 +49,4 @@ You may now run it with the artisan migrate command: $ php artisan migrate --seed -After running this command the filled countries table will be available \ No newline at end of file +After running this command the filled countries table will be available diff --git a/composer.json b/composer.json index 9c3a288..601056d 100644 --- a/composer.json +++ b/composer.json @@ -36,15 +36,5 @@ "support" : { "source" : "https://github.com/webpatser/laravel-countries", "issues" : "https://github.com/webpatser/laravel-countries/issues" - }, - "extra": { - "laravel": { - "providers": [ - "Webpatser\\Countries\\CountriesServiceProvider" - ], - "aliases": { - "Countries": "Webpatser\\Countries\\CountriesFacade" - } - } - } + } } diff --git a/src/Webpatser/Countries/Countries.php b/src/Webpatser/Countries/Countries.php index 0491294..324240c 100644 --- a/src/Webpatser/Countries/Countries.php +++ b/src/Webpatser/Countries/Countries.php @@ -50,7 +50,7 @@ protected function getCountries() /** * Returns one country - * + * * @param string $id The country id * * @return array @@ -63,9 +63,9 @@ public function getOne($id) /** * Returns a list of countries - * + * * @param string sort - * + * * @return array */ public function getList($sort = null) @@ -75,7 +75,7 @@ public function getList($sort = null) //Sorting $validSorts = [ - 'capital', + 'capital', 'citizenship', 'country-code', 'currency', @@ -103,7 +103,7 @@ public function getList($sort = null) return 1; } else { return strcasecmp($a[$sort], $b[$sort]); - } + } }); } diff --git a/src/Webpatser/Countries/Models/countries.json b/src/Webpatser/Countries/Models/countries.json index 3408d9e..44fe0e7 100644 --- a/src/Webpatser/Countries/Models/countries.json +++ b/src/Webpatser/Countries/Models/countries.json @@ -1706,7 +1706,7 @@ "citizenship":"Guadeloupean", "country-code":"312", "currency":"euro", - "currency_code":"EUR", + "currency_code":"EUR ", "currency_sub_unit":"cent", "full_name":"Guadeloupe", "iso_3166_2":"GP", @@ -3665,7 +3665,7 @@ "citizenship":"San Marinese", "country-code":"674", "currency":"euro", - "currency_code":"EUR", + "currency_code":"EUR ", "currency_sub_unit":"cent", "full_name":"Republic of San Marino", "iso_3166_2":"SM", diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index 5678bd6..4ce11ba 100644 --- a/src/commands/MigrationCommand.php +++ b/src/commands/MigrationCommand.php @@ -1,4 +1,4 @@ -addNamespace('countries',substr(__DIR__,0,-8).'views'); } - + /** * Execute the console command. * * @return void */ - public function fire() + public function handle() { $this->line(''); $this->info('The migration process will create a migration file and a seeder for the countries list'); @@ -53,16 +53,14 @@ public function fire() { $this->line(''); - if (version_compare(app()->version(), '5.5.0', '<')) { - $this->call('optimize', []); - } + $this->call('optimize', []); $this->line(''); $this->info( "Migration successfully created!" ); } else{ - $this->error( + $this->error( "Coudn't create migration.\n Check the write permissions". " within the app/database/migrations directory." ); @@ -72,16 +70,6 @@ public function fire() } } - /** - * Alias fire method. - * - * @return void - */ - public function handle() - { - $this->fire(); - } - /** * Get the console command options. * @@ -109,7 +97,7 @@ protected function createMigration() $seconds = 0; - foreach ($migrationFiles as $migrationFile => $outputFile) { + foreach ($migrationFiles as $migrationFile => $outputFile) { if (sizeof(glob($migrationFile)) == 0) { $migrationFile = str_replace('*', date('Y_m_d_His', strtotime('+' . $seconds . ' seconds')), $migrationFile); @@ -143,5 +131,12 @@ protected function createMigration() return true; } - + + /** + * BC for older laravel versions + */ + public function fire() + { + $this->handle(); + } }