From dafe6954e05feea78b6ffa52197ec8535ca2d44b Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 14:23:10 -0200 Subject: [PATCH 01/10] Fix: PHP 7.2 E_WARNING about sizeof() --- src/Webpatser/Countries/Countries.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Webpatser/Countries/Countries.php b/src/Webpatser/Countries/Countries.php index ca21d19..9ab1f94 100644 --- a/src/Webpatser/Countries/Countries.php +++ b/src/Webpatser/Countries/Countries.php @@ -40,7 +40,7 @@ public function __construct() protected function getCountries() { //Get the countries from the JSON file - if (sizeof($this->countries) == 0){ + if (empty($this->countries)){ $this->countries = json_decode(file_get_contents(__DIR__ . '/Models/countries.json'), true); } From bb0fdcc8270dc8923711809654512dcb38741560 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:23:45 -0200 Subject: [PATCH 02/10] Update composer.json --- composer.json | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/composer.json b/composer.json index 9c3a288..b7d50a9 100644 --- a/composer.json +++ b/composer.json @@ -36,15 +36,6 @@ "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" - } - } + } } } From bc6be318670062b6d5784dbcd451c0b70a0705a2 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:24:16 -0200 Subject: [PATCH 03/10] Update composer.json --- composer.json | 1 - 1 file changed, 1 deletion(-) diff --git a/composer.json b/composer.json index b7d50a9..601056d 100644 --- a/composer.json +++ b/composer.json @@ -37,5 +37,4 @@ "source" : "https://github.com/webpatser/laravel-countries", "issues" : "https://github.com/webpatser/laravel-countries/issues" } - } } From 074c11eba765660d7d2576e2d73820c37154ccc8 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:25:34 -0200 Subject: [PATCH 04/10] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 0defe6b..221a38b 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' => [ @@ -52,4 +50,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 From cbc20283b3a5ce11449effccae30a9bb650fea74 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:26:13 -0200 Subject: [PATCH 05/10] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 221a38b..98377a7 100644 --- a/README.md +++ b/README.md @@ -38,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` From fa70f7ea39101c09a9ea0f3eddd2eefb80de9410 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:27:21 -0200 Subject: [PATCH 06/10] Update countries.json --- src/Webpatser/Countries/Models/countries.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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", From c74fcb6ea884d323b68fee143d68bc0f8b37bd5a Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:27:50 -0200 Subject: [PATCH 07/10] Update MigrationCommand.php --- src/commands/MigrationCommand.php | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index 5678bd6..ba74c95 100644 --- a/src/commands/MigrationCommand.php +++ b/src/commands/MigrationCommand.php @@ -72,16 +72,6 @@ public function fire() } } - /** - * Alias fire method. - * - * @return void - */ - public function handle() - { - $this->fire(); - } - /** * Get the console command options. * From a7dc5c16b08a63445ba791f22c5b490939b37052 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:28:19 -0200 Subject: [PATCH 08/10] Update MigrationCommand.php --- src/commands/MigrationCommand.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index ba74c95..a58e071 100644 --- a/src/commands/MigrationCommand.php +++ b/src/commands/MigrationCommand.php @@ -53,9 +53,7 @@ public function fire() { $this->line(''); - if (version_compare(app()->version(), '5.5.0', '<')) { - $this->call('optimize', []); - } + $this->call('optimize', []); $this->line(''); From 4eb34fa9ea80674a435eecccb13022b0629f0db1 Mon Sep 17 00:00:00 2001 From: "Mateus Felipe C. C. Pinto" Date: Wed, 3 Jan 2018 16:28:57 -0200 Subject: [PATCH 09/10] Update README.md From 860e1ab5fa5e19fe362c2b19f4150961374f71b3 Mon Sep 17 00:00:00 2001 From: Christoph Kempen Date: Wed, 16 May 2018 08:22:32 +0200 Subject: [PATCH 10/10] command handle/fire for compatibility for older laravel versions --- src/commands/MigrationCommand.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/commands/MigrationCommand.php b/src/commands/MigrationCommand.php index a58e071..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'); @@ -60,7 +60,7 @@ public function fire() $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." ); @@ -97,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); @@ -131,5 +131,12 @@ protected function createMigration() return true; } - + + /** + * BC for older laravel versions + */ + public function fire() + { + $this->handle(); + } }