beautycoding / modelutils
laravel的模型工具
1.2.0
2016-06-20 09:02 UTC
Requires
- ramsey/uuid: ^3.2
This package is not auto-updated.
Last update: 2024-09-24 20:43:42 UTC
README
为了安装Laravel 5 ModelUtils,只需将以下内容添加到您的composer.json中:
"beautycoding/modelutils": "dev-master"
然后运行composer install或composer update。
然后在您的config/app.php中添加
BeautyCoding\ModelUtils\ModelUtilsServiceProvider::class,
发布配置
php artisan vendor:publish
编辑配置文件config/modelutils.php并使用自己的命名空间。
在适当的模型特质UuidModel中使用
<?php use Illuminate\Database\Eloquent\Model; use BeautyCoding\ModelUtils\Traits\UuidModel; class User extends Model { use UuidModel; // add this trait to your model ... }
模型必须有一个名为uuid的字段(32个字符长)。有关更多信息,请参阅RFC。