Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Uuid Laravel Package

michalkortas/laravel-uuid

View on GitHub
Deep Wiki
Context7

laravel-uuid

Simply create Eloquent Models & database tables with UUID/GUID primary keys.

Installation

composer require michalkortas/laravel-uuid

Usage

Add uuid as primary key in your table migration.

Schema::create('customers', function (Blueprint $table) {
    $table->uuid('id')->primary();
});

Add trait to your Eloquent Model.

<?php

namespace AppModels;

use michalkortas\LaravelUuid\traits\HasUuid;
use Illuminate\Database\Eloquent\Model;

class Customers extends Model
{
    use HasUuid;
}

Now, when you run migrations, newly created table has datatype ID as CHAR(36). UUID will be inserted automatically with Model::create() method.

ID datatype - UUID - CHAR(36)

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony
spatie/flare-daemon-runtime