New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

gurzhii/laravel-sluggable-trait

A trait you can apply to Eloquent models to have slugs automatically generated on save.
270
Install
composer require gurzhii/laravel-sluggable-trait
Latest Version:1.0.0
PHP:>=5.4.0
Laravel:4 · 5
License:MIT
Last Updated:May 11, 2016
Links: GitHub  ·  Packagist
Maintainer: Gurzhii

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.

Related Packages

cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

15,577,064 3,994
bpocallaghan/sluggable

Provides a HasSlug trait that will generate a unique slug when saving your Larav...

26,998 6
nunomaduro/laravel-sluggable

Automatic slug generation for Eloquent models via the #[Sluggable] attribute.

15,360 153
pavelpaliy/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

2,145 0
sibche/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel 5.

467 0

Version History

Version Released PHP Laravel License
1.0.0 >=5.4.0 >=4.0 MIT
0.2.0 >=5.4.0 >=4.0 MIT