Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Sluggable For Laravel Laravel Package

roundly-consulting/sluggable-for-laravel

A Laravel package for adding automatic, customizable slug generation to Eloquent models. Create unique, SEO-friendly URLs from titles or other attributes with configurable source fields, uniqueness handling, and simple model integration.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Treat 1.1.3 as a low-risk patch release. It fixes factories so they build the configured model when a host application swaps the package’s model.
  • Install or upgrade normally, but require ^1.1.3 if your host app replaces package models and relies on package factories in tests or seeders.
  • Look first at the package config/model binding, the service provider registration, and the package factory classes. Those are the places that determine which model a factory builds.
  • First use case: in a host app that binds a custom model, create records through the package factory and confirm the returned instance is your host model, not the package default.

Implementation Patterns

  • Prefer config/container-driven model resolution over hardcoded model class names. A host model swap should require a binding/config change, and factories should follow automatically.
  • In tests, create records through the package factory, then assert the concrete class:
    • $this->assertInstanceOf(ConfiguredModel::class, $record);
  • Use factories in seeders after swapping the host model so local/demo data matches the host application’s model.
  • If you previously worked around the bug by overriding factories or manually replacing model classes, remove those workarounds where possible and let 1.1.3 resolve the configured model.
  • Add a regression test around host model swapping: bind a custom model, call the package factory, and assert the custom model is built.

Gotchas and Tips

  • Hardcoded new Model or Model::class references inside custom factory code can still bypass the fix. Search factory overrides for direct model references.
  • Clear config caches after changing model bindings: php artisan config:clear.
  • Binding order matters. Ensure the host model binding/config is registered before factory resolution occurs.
  • Debug model swapping by dumping the factory result class and the configured model value side by side.
  • This is a patch release; no breaking changes are indicated. The main extension points remain config/model bindings and factory overrides, so check the package docs for exact config keys and factory hooks.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource