---
title: "Adoption & limitations — Sluggable for Laravel | Roundly"
description: "Map the options of an existing slug setup onto sluggable, compose it with other traits, and know exactly where its limits are."
url: https://roundly-consulting.com/open-source/docs/sluggable-for-laravel/adoption
language: en
---

[All packages](https://roundly-consulting.com/open-source.md)

[Sluggable for Laravel](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel.md)

# Adoption & limitations

With the default options every generated slug matches Str::slug() for ordinary input of up to 255 characters, so switching an existing model keeps its URLs. Typical options map like this:

| Typical option elsewhere | Sluggable |
| --- | --- |
| Generate from name into slug | `Zero config, or #[Slug('slug', from: 'name')]` |
| Regenerate on update | `->onUpdate(UpdatePolicy::WhenSourceChanges) (or keep IfEmpty + ->keepHistory())` |
| Suffix starts at -1 | `->sequentialSuffix(start: 1)` |
| Global uniqueness vs a scoped DB index | `->uniqueWithin('clinic_id')` |
| Manual getRouteKeyName() | `->routeKey()` |
| “Don’t regenerate on update” / “prevent overwrite” | `->immutable() / ManualSlugPolicy` |

Run php artisan sluggable:duplicates before switching on a unique index, then sluggable:regenerate --mode=missing to fill any empty slugs.

## Composing with other traits

- HasSlug overrides performInsert, performUpdate, getRouteKeyName, getRouteKey, resolveRouteBindingQuery, resolveRouteBinding, resolveSoftDeletableRouteBinding and resolveChildRouteBinding — a trait overriding the same methods needs insteadof.
- A method declared on the model class itself silently wins over the trait.
- Helpers are prefixed sluggable…, and HasSlug declares none of currentLocale, fallbackLocale, readMap, writeMap, getTranslation(s) or setTranslation(s), so it composes with the common translation traits without insteadof.
- Hooks run in creating/updating (not saving), after trait listeners declared earlier — declare a trait that sets a scope column (e.g. a tenant id) before HasSlug.

## Limitations

- Query-builder insert()/upsert(), saveQuietly() and withoutEvents() fire no model events and so generate nothing — call Slugs::apply($model) first.
- A no-op save() does not back-fill (Laravel fires updating only for dirty models) — use regenerateSlugs(), Slugs::model(X::class)->regenerate() or sluggable:regenerate --mode=missing.
- A model loaded without its slug column (select('id'), select(\['id', 'name'\])) keeps its stored slug: save(), touch(), restore(), regenerateSlugs() and Slugs::apply() leave that column alone — even under regenerateOnUpdate() — and never read it, so preventAccessingMissingAttributes() stays happy. Load the column (or refresh()) to have it generated.
- A race retry re-fires creating/updating for your listeners too; use retries(0) for models with non-idempotent listeners.
- createOrFirst() keyed on the slug does not dedupe on it (nor does a racing firstOrCreate(); a non-racing one selects first and finds the row): Normalize/Verbatim insert a suffixed row (php-2), Strict throws SlugAlreadyTakenException, which createOrFirst() does not catch. Key such calls on another unique column, or catch the exception.
- Across-locales and closure-scoped uniqueness are application-level only.
- One history key\_type per host.
- Language-switch redirects and sitemap helpers are not included — listen for SlugChanged to drive your own.

## Show your open-source love

This package is free and MIT-licensed. If it saves you time, a one-off donation or a Patreon membership keeps it maintained, tested and documented.

[More ways to support, including crypto](https://roundly-consulting.com/support-us.md)

By donating, you agree to our [donation terms](https://roundly-consulting.com/donation-terms.md).

[Support our open source work (opens in a new tab)](https://donate.stripe.com/dRmeVe8FX5PF1Qd9pXcEw00) [Join us on Patreon (opens in a new tab)](https://www.patreon.com/cw/roundly)

## Want this built into your product?

We integrate our packages into custom Laravel and AI builds. Tell us what you're working on and we'll reply within 48 hours.

[Get a quote in 48 hours](https://roundly-consulting.com/contact.md) [Browse all packages](https://roundly-consulting.com/open-source/docs/sluggable-for-laravel.md)
