Skip to content

Releases: whitecube/laravel-sluggable

Bug fix

27 Apr 15:34
7397440
Compare
Choose a tag to compare
v1.6.7

Fixed SQL placeholder in whereRaw query

Bug fix

27 Apr 15:30
612f92c
Compare
Choose a tag to compare
v1.6.6

Fixed translated slug query since SQL injection fix

Security fix

25 Apr 15:39
2c1aae2
Compare
Choose a tag to compare

Laravel 11

20 Mar 09:58
3dc81d8
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.6.3...v1.6.4

Bug fix

15 Dec 16:30
d8ae9c0
Compare
Choose a tag to compare
  • Fixed infinite redirections for different models with matching slugs in another locale. Thanks @JonathanRixhon !

Laravel 10

16 Feb 09:56
3b75300
Compare
Choose a tag to compare
Merge pull request #3 from whitecube/laravel-10

Laravel 10

v1.6.1

11 Feb 14:32
65f58dd
Compare
Choose a tag to compare

Fixed dependencies

v1.6.0

11 Feb 14:25
e74a623
Compare
Choose a tag to compare

Added Laravel 9 compatibility

Added getSlugExistsQuery method (to allow overriding) & fixed unique slug generation

15 Mar 22:25
Compare
Choose a tag to compare

Fixed a problem with the slug generation if the slug already existed.

Previously, if the following slugs (foo, foo-1) existed in the database, the generated slug would end up being foo-1-1.
Now, it correctly generates foo-2.

Added getSlugExistsQuery method to allow overriding at the model level

Imagine your slug has a unique constraint based on the user_id. This means both user A and user B can have a post with the slug foo, but they can only have one post with that slug, each.

Previously, the package would hardcode the query that checks if the slug exists, and this use case couldn't be handled; the package had no way of knowing that it had to check the slugs for each user individually.

This can now be done by overriding the getSlugExistsQuery method:

protected function getSlugExistsQuery($whereKey, $slug)
{
    return static::where($whereKey, $slug)
        ->where('user_id', $this->user_id)
        ->withoutGlobalScopes();
}

Support for PHP 8

15 Jan 15:32
0734d2d
Compare
Choose a tag to compare
v1.5.0

Added support for PHP 8