duyduc-nguyen/laravel-sluggable-trait
Create unique slugs for your Eloquent models in Laravel. Support Cache
35
3
| Install | |
|---|---|
composer require duyduc-nguyen/laravel-sluggable-trait |
|
| Latest Version: | 0.1.2 |
| PHP: | >=5.4.0 |
| License: | MIT |
| Last Updated: | Oct 25, 2015 |
| Links: | GitHub · Packagist |
Maintainer: duyduc-nguyen
Laravel Sluggable Trait
Create unique slugs for your Eloquent models in Laravel. Support Cache
Install
$ composer require duyduc-nguyen/laravel-sluggable-trait
Usage
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use DuyDucNguyen\Database\Traits\SluggableTrait;
class Item extends Model {
use SluggableTrait;
}
First, you need to indicate sluggable column and slug column of your model via class constants:
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use DuyDucNguyen\Database\Traits\SluggableTrait;
class Item extends Model {
use Sluggable;
const SLUGGABLE_COLUMN = 'title';
const SLUG = 'slug';
}
If you need to improve your query for searching slug, you can enable Laravel Cache for caching slug via
const ENABLE_SLUG_CACHE = true;
License
Licensed under the MIT Licence.
Related Packages
kodeine/laravel-acl
Light-weight role-based permissions for Laravel 5 built in Auth system.
361,720
777
hootlex/laravel-friendships
This package gives Eloquent models the ability to manage their friendships.
119,502
700
mpociot/laravel-firebase-sync
Synchronize your Eloquent models with a Firebase realtime database.
153,313
265