alzpk / larauuid
一个小型包装,使在Laravel中使用uuid变得简单
1.0.0
2022-04-25 18:23 UTC
Requires
- php: ^7.3|^8.0
This package is auto-updated.
Last update: 2024-09-25 23:40:05 UTC
README
一个小型包装,使在Laravel中使用uuid变得简单
安装
要安装此包,请在您的Laravel项目中运行以下composer命令。
composer require alzpk/larauuid
使用方法
要使用此包,只需在模型中使用Alzpk\Larauuid
即可。
示例
namespace App\Models; use Alzpk\Larauuid\Larauuid; use Illuminate\Database\Eloquent\Model; class Post extends Model { use Larauuid; }
请记住在迁移中使用uuid,如下所示
public function up() { Schema::create('posts', function (Blueprint $table) { $table->uuid('id')->primary(); $table->string('title'); $table->text('message'); $table->timestamps(); }); }