gurzhii/laravel-sluggable-trait
Composer 安装命令:
composer require gurzhii/laravel-sluggable-trait
包简介
A trait you can apply to Eloquent models to have slugs automatically generated on save.
README 文档
README
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.
统计信息
- 总下载量: 270
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-04-22