Weave Code
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

Laravel Sluggable Laravel Package

spatie/laravel-sluggable

Automatically generate unique slugs for Eloquent models on create/update. Supports collision suffixes, translatable slugs, and customizable slug options. Includes “self-healing” URLs that keep old links working via slug+id route keys and redirects.

View on GitHub
Deep Wiki
Context7

title: Finding models by slug weight: 4

The HasSlug trait adds a static findBySlug() helper that queries the slug column configured through saveSlugsTo().

$article = Article::findBySlug('my-article');

The second argument is a list of columns to select, matching Eloquent's find():

Article::findBySlug('my-article', ['id', 'slug', 'title']);

A third argument takes a callable that can add extra constraints to the query before it runs:

Article::findBySlug('my-article', ['*'], fn ($query) => $query->where('published', true));

For translatable slugs, HasTranslatableSlug ships its own findBySlug() that looks in both the current locale and the application fallback locale.

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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle