Looking to hire Laravel developers? Try LaraJobs

laravel-sluggable maintained by codinglabsau

Description
Generate slugs when saving Eloquent models
Author
Last update
2024/03/11 05:23 (dev-main)
License
Downloads
9 020

Comments
comments powered by Disqus

Laravel Sluggable

Build Status Latest Stable Version Total Downloads License

A super simple, opinionated trait to add slugs to models in Laravel.

Installation

Via Composer

$ composer require codinglabsau/laravel-sluggable

Usage

Add name and slug columns to your model

This package watches for changes on the name attribute, and automatically slugifies the slug column.

Add the trait

Add the Sluggable trait to your user model:

use Codinglabs\Sluggable\Sluggable;
use Illuminate\Database\Eloquent\Model;

class Product extends Model
{
    use Sluggable;
}

Contributing

Feel free to create a PR with tests!

Security

If you discover any security related issues, create an issue on GitHub.

Credits

License

MIT. Please see the license file for more information.

About Coding Labs

Coding Labs is a web app development agency based on the Gold Coast, Australia. See our open source projects on our website.