Skip to content

A trait you can apply to Eloquent models to have slugs automatically generated on save.

License

Notifications You must be signed in to change notification settings

Gurzhii/laravel-sluggable-trait

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Sluggable Trait

A trait you can apply to Eloquent models to have slugs automatically generated on save.

Installation

$ composer require gurzhii/laravel-sluggable-trait

Usage

<?php namespace App;

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

class Item extends Model {

	use Sluggable;

}

By default, the trait assumes your database has two columns: name and slug. If you need to change these, you can do so via class constants:

<?php namespace App;

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

class Item extends Model {

	use Sluggable;

	const DISPLAY_NAME = 'headline';
	const SLUG = 'seo_url';

}

License

Licensed under the MIT Licence.

About

A trait you can apply to Eloquent models to have slugs automatically generated on save.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%