Skip to content

UUID Primary Key Support for Entity ORM Model#227

Merged
techmahedy merged 5 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x
Mar 12, 2026
Merged

UUID Primary Key Support for Entity ORM Model#227
techmahedy merged 5 commits intodoppar:3.xfrom
techmahedy:techmahedy-3.x

Conversation

@techmahedy
Copy link
Copy Markdown
Member

This PR introduces UUID primary key support for the Entity Builder (model-based queries) across all three supported database drivers: MySQL, PostgreSQL, and SQLite.

Migration

Schema::create('tests', function (Blueprint $table) {
    $table->uuid('test_id')->primary();
    $table->string('test_name');
    $table->timestamps();
});

Model

class Test extends Model
{
    protected $table = 'tests';
    protected $primaryKey = 'test_id';

    protected $creatable = [
        'test_id',
        'test_name',
    ];

    #[Hook('before_created')]
    public function generateUuid(): void
    {
        $this->test_id = Str::uuid();
    }
}

Usage

Test::create(['test_name' => 'test']);

@techmahedy techmahedy added the feat new feature label Mar 12, 2026
@techmahedy techmahedy merged commit 606e779 into doppar:3.x Mar 12, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant