Skip to content

Extending Sluggable

Shipu Ahamed edited this page Sep 3, 2016 · 1 revision

Extending Sluggable

Sometimes the configuration options aren't sufficient for complex needs (e.g. maybe the uniqueness test needs to take other attributes into account, or maybe you need to make two slugs for the same model).

In instances like these, we try to offer hooks into the slugging workflow where you can use your own functions, either on a per-model basis, or in your own trait that extends the package's trait.

NOTE: Previously, these hooks were usually accessed by overloading methods on your model. However, because the package now uses the SlugService class to do the heavy-lifting, you need to either use entry points we've already provided, or extend SlugService class directly.

Clone this wiki locally