From 9a14b1eb0910d4148b6ed60ad23e9038564941d0 Mon Sep 17 00:00:00 2001 From: ARCANEDEV Date: Wed, 4 Sep 2019 12:06:40 +0100 Subject: [PATCH] Adding Laravel 6.0 support --- .scrutinizer.yml | 2 +- .travis.yml | 2 -- README.md | 6 +++--- _docs/0-Home.md | 2 +- _docs/1-Installation-and-Setup.md | 3 +++ composer.json | 10 +++++----- src/Utilities/RouteTranslator.php | 2 +- tests/Entities/LocaleTest.php | 3 ++- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ff9c7ac..ba44fae 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,7 +22,7 @@ checks: tools: external_code_coverage: timeout: 1200 - runs: 4 + runs: 2 php_code_sniffer: enabled: true config: diff --git a/.travis.yml b/.travis.yml index 6aee27e..e170a4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,6 @@ language: php sudo: false php: - - 7.1.3 - - 7.1 - 7.2 - 7.3 - nightly diff --git a/README.md b/README.md index 316940f..3e7db50 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Localization [![Packagist License][badge_license]](LICENSE.md) [![For Laravel 5][badge_laravel]][link-github-repo] +# Localization [![Packagist License][badge_license]](LICENSE.md) [![For Laravel 5/6][badge_laravel]][link-github-repo] [![Travis Status][badge_build]][link-travis] [![Coverage Status][badge_coverage]][link-scrutinizer] @@ -21,7 +21,7 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/Localization/ ### Features * Easy setup & configuration. - * Laravel `5.0` to `5.8` are supported. + * Laravel `5.x` & `6.0` are supported. * SEO-Friendly (Search engine optimization). * New extended Router to manage your localized routes. * Translated Eloquent Models. @@ -52,7 +52,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail. - [All Contributors][link-contributors] [badge_license]: http://img.shields.io/packagist/l/arcanedev/localization.svg?style=flat-square -[badge_laravel]: https://img.shields.io/badge/For-Laravel%205.x-orange.svg?style=flat-square +[badge_laravel]: https://img.shields.io/badge/For-Laravel%205.x%20to%206.0-orange.svg?style=flat-square [badge_build]: http://img.shields.io/travis/ARCANEDEV/Localization.svg?style=flat-square [badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/Localization.svg?style=flat-square [badge_quality]: https://img.shields.io/scrutinizer/g/ARCANEDEV/Localization.svg?style=flat-square diff --git a/_docs/0-Home.md b/_docs/0-Home.md index 3ed5e1b..bd65833 100644 --- a/_docs/0-Home.md +++ b/_docs/0-Home.md @@ -7,7 +7,7 @@ Feel free to check out the [Releases](https://github.com/ARCANEDEV/Localization/ ### Features * Easy setup & configuration. - * Laravel `5.0` to `5.8` are supported. + * Laravel `5.x` & `6.0` are supported. * SEO-Friendly (Search engine optimization). * New extended Router to manage your localized routes. * Locales selector menu (Publishable & Customizable). diff --git a/_docs/1-Installation-and-Setup.md b/_docs/1-Installation-and-Setup.md index 59a51c5..fa57b26 100644 --- a/_docs/1-Installation-and-Setup.md +++ b/_docs/1-Installation-and-Setup.md @@ -29,6 +29,7 @@ PHP extensions: | ![Localization v3.x][localization_3_x] | ![Laravel v5.6][laravel_5_6] | | ![Localization v4.x][localization_4_x] | ![Laravel v5.7][laravel_5_7] | | ![Localization v5.x][localization_5_x] | ![Laravel v5.8][laravel_5_8] | +| ![Localization v6.x][localization_6_x] | ![Laravel v6.0][laravel_6_0] | [laravel_5_0]: https://img.shields.io/badge/v5.0-supported-brightgreen.svg?style=flat-square "Laravel v5.0" [laravel_5_1]: https://img.shields.io/badge/v5.1-supported-brightgreen.svg?style=flat-square "Laravel v5.1" @@ -39,6 +40,7 @@ PHP extensions: [laravel_5_6]: https://img.shields.io/badge/v5.6-supported-brightgreen.svg?style=flat-square "Laravel v5.6" [laravel_5_7]: https://img.shields.io/badge/v5.7-supported-brightgreen.svg?style=flat-square "Laravel v5.7" [laravel_5_8]: https://img.shields.io/badge/v5.8-supported-brightgreen.svg?style=flat-square "Laravel v5.8" +[laravel_6_0]: https://img.shields.io/badge/v6.0-supported-brightgreen.svg?style=flat-square "Laravel v6.0" [localization_0_x]: https://img.shields.io/badge/version-0.*-blue.svg?style=flat-square "Localization v0.*" [localization_1_x]: https://img.shields.io/badge/version-1.*-blue.svg?style=flat-square "Localization v1.*" @@ -46,6 +48,7 @@ PHP extensions: [localization_3_x]: https://img.shields.io/badge/version-3.*-blue.svg?style=flat-square "Localization v3.*" [localization_4_x]: https://img.shields.io/badge/version-4.*-blue.svg?style=flat-square "Localization v4.*" [localization_5_x]: https://img.shields.io/badge/version-5.*-blue.svg?style=flat-square "Localization v5.*" +[localization_6_x]: https://img.shields.io/badge/version-6.*-blue.svg?style=flat-square "Localization v6.*" ## Composer diff --git a/composer.json b/composer.json index 5923559..2c8b35b 100644 --- a/composer.json +++ b/composer.json @@ -14,15 +14,15 @@ "type": "library", "license": "MIT", "require": { - "php": ">=7.1.3", + "php": ">=7.2.0", "ext-json": "*", - "arcanedev/support": "~4.5.0" + "arcanedev/support": "~5.0.0" }, "require-dev": { - "orchestra/testbench": "~3.8.0", + "orchestra/testbench": "~4.0.0", "mockery/mockery": "~1.0", - "phpunit/phpcov": "~5.0|~6.0", - "phpunit/phpunit": "~7.0|~8.0" + "phpunit/phpcov": "~6.0", + "phpunit/phpunit": "~8.0" }, "autoload": { "psr-4": { diff --git a/src/Utilities/RouteTranslator.php b/src/Utilities/RouteTranslator.php index 941f7e9..b16ee37 100644 --- a/src/Utilities/RouteTranslator.php +++ b/src/Utilities/RouteTranslator.php @@ -237,7 +237,7 @@ private function translate($key, $locale = null) if (is_null($locale)) $locale = $this->translator->getLocale(); - $translation = $this->translator->trans($key, [], $locale); + $translation = $this->translator->get($key, [], $locale); // @codeCoverageIgnoreStart if ( ! is_string($translation)) diff --git a/tests/Entities/LocaleTest.php b/tests/Entities/LocaleTest.php index 9a8b4f0..f975d76 100644 --- a/tests/Entities/LocaleTest.php +++ b/tests/Entities/LocaleTest.php @@ -2,6 +2,7 @@ use Arcanedev\Localization\Entities\Locale; use Arcanedev\Localization\Tests\TestCase; +use Illuminate\Support\Arr; /** * Class LocaleTest @@ -118,7 +119,7 @@ private function makeLocale($key) */ private function getLocale($key) { - return array_get([ + return Arr::get([ 'ar' => [ 'name' => 'Arabic', 'script' => 'Arab',