HasUuids

2.1 2023-09-21 06:28 UTC

This package is auto-updated.

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


README

UUID traits for Laravel

Usage/Examples

Model

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

Migration

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