diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ae9a48b..75f062b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - php: [8.0] + php: [8.1, 8.0] laravel: [8.76.1] dependency-version: [prefer-lowest, prefer-stable] @@ -18,17 +18,6 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Determine composer cache directory - id: determine-composer-cache-directory - run: 'echo "::set-output name=directory::$(composer config cache-dir)"' - - - name: Cache dependencies - uses: actions/cache@v2 - with: - path: ${{ steps.determine-composer-cache-directory.outputs.directory }} - key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }} - restore-keys: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer- - - name: Setup PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml new file mode 100644 index 0000000..fa56639 --- /dev/null +++ b/.github/workflows/update-changelog.yml @@ -0,0 +1,28 @@ +name: "Update Changelog" + +on: + release: + types: [released] + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: main + + - name: Update Changelog + uses: stefanzweifel/changelog-updater-action@v1 + with: + latest-version: ${{ github.event.release.name }} + release-notes: ${{ github.event.release.body }} + + - name: Commit updated CHANGELOG + uses: stefanzweifel/git-auto-commit-action@v4 + with: + branch: main + commit_message: Update CHANGELOG + file_pattern: CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 0620ced..0fafdf0 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes to `laravel-sluggable` will be documented in this file +## 3.1.1 - 2021-12-13 + +## What's Changed + +- Migrate to PHP-CS-Fixer 3.x by @shuvroroy in https://github.com/spatie/laravel-sluggable/pull/203 +- Adds test case for replicate method by @eduarguz in https://github.com/spatie/laravel-sluggable/pull/212 +- Fix Deprecation: currentSlug is null by @phh in https://github.com/spatie/laravel-sluggable/pull/218 + +## New Contributors + +- @shuvroroy made their first contribution in https://github.com/spatie/laravel-sluggable/pull/203 +- @eduarguz made their first contribution in https://github.com/spatie/laravel-sluggable/pull/212 +- @phh made their first contribution in https://github.com/spatie/laravel-sluggable/pull/218 + +**Full Changelog**: https://github.com/spatie/laravel-sluggable/compare/3.1.0...3.1.1 + ## 3.1.0 - 2021-06-04 - add extra scope callback option (#201) @@ -63,9 +79,11 @@ All notable changes to `laravel-sluggable` will be documented in this file - drop support for anything below PHP 7.4 and Laravel 6 ## 2.2.1 - 2019-09-16 + - Changed: Updated Laravel 6 compatibility for future versions ## 2.2.0 - 2019-09-04 + - Drop support for PHP 7.1 - Add support for Laravel 6.0 @@ -98,36 +116,47 @@ All notable changes to `laravel-sluggable` will be documented in this file - Support Laravel 5.6 ## 2.1.1 - 2017-01-28 + - improve compatibility with Lumen ## 2.1.0 - 2017-09-13 + - add `usingLanguage` ## 2.0.0 - 2017-08-31 + - add support for Laravel 5.5, drop support for all older versions of the framework ## 1.5.2 - 2018-05-08 + - make compatible with PHP 7.2 ## 1.5.1 - 2017-08-19 + - fix bugs when using a custom separator ## 1.5.0 - 2017-04-13 + - add `usingSeparator()` ## 1.4.1 - 2017-04-11 -- ignore global scopes when determining a unique slug + +- ignore global scopes when determining a unique slug ## 1.4.0 - 2017-01-24 + - add support for Laravel 5.4 ## 1.3.0 - 2016-11-14 + - add `doNotGenerateSlugsOnCreate` and `doNotGenerateSlugsOnUpdate` ## 1.2.0 - 2016-06-13 + - Added the ability to generate slugs from a callable ## 1.1.0 - 2016-01-24 + - Allow custom slugs ## 1.0.2 - 2016-01-12 diff --git a/composer.json b/composer.json index c60577b..56f03e7 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "illuminate/support": "^8.0" }, "require-dev": { - "orchestra/testbench": "^5.16|^6.11", + "orchestra/testbench": "^6.23", "spatie/laravel-translatable": "^4.6", "friendsofphp/php-cs-fixer": "^2.18", "phpunit/phpunit": "^9.5.1" diff --git a/src/HasTranslatableSlug.php b/src/HasTranslatableSlug.php index 2fdec7e..2c1cdab 100644 --- a/src/HasTranslatableSlug.php +++ b/src/HasTranslatableSlug.php @@ -65,7 +65,7 @@ protected function generateNonUniqueSlug(): string $slugGeneratedFromCallable = is_callable($this->slugOptions->generateSlugFrom); $hasCustomSlug = $this->hasCustomSlugBeenUsed() && ! empty($slug); - $hasNonChangedCustomSlug = ! $slugGeneratedFromCallable && ! $this->slugIsBasedOnTitle() && ! empty($slug); + $hasNonChangedCustomSlug = ! $slugGeneratedFromCallable && ! empty($slug) && ! $this->slugIsBasedOnTitle(); if ($hasCustomSlug || $hasNonChangedCustomSlug) { $slugString = $slug;