alzpk/larauuid

一个小型包装,使在Laravel中使用uuid变得简单

安装: 19

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 1

分支: 0

开放问题: 0

类型:package

1.0.0 2022-04-25 18:23 UTC

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();
        });
    }