具有Uuids

2.1 2023-09-21 06:28 UTC

This package is auto-updated.

Last update: 2024-09-21 08:31:55 UTC


README

Laravel的UUID特性

用法/示例

模型

use Traits\HasUuids;class User extends Authenticatable
{
    use Notifiable,UUID;

迁移

return new class extends Migration {
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('users', function (Blueprint $table) {
            $table->uuid('id')->primary();
            $table->string('username')->unique();
            $table->string('password')->nullable();
            $table->rememberToken();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('users');
    }
};