PHPackages                             jamesh/laravel-uuid - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. jamesh/laravel-uuid

Abandoned → Laravel 9+ provide an HasUuids trait.ArchivedPlugin[Database &amp; ORM](/categories/database)

jamesh/laravel-uuid
===================

Eloquent UUID Trait for Laravel 6 and above.

2.0.1(4y ago)2060.1k8MITPHPPHP ^7.4|^8.0

Since Apr 27Pushed 3y ago1 watchersCompare

[ Source](https://github.com/JamesHemery/laravel-uuid)[ Packagist](https://packagist.org/packages/jamesh/laravel-uuid)[ RSS](/packages/jamesh-laravel-uuid/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (4)Versions (10)Used By (0)

laravel-uuid
============

[](#laravel-uuid)

Eloquent UUID Trait for Laravel 5.7 and above.

⚠️ This package will no longer be maintained. [The HasUuids feature has been added in Laravel 9.](https://laravel.com/docs/9.x/eloquent#uuid-and-ulid-keys)

[![Github Actions](https://camo.githubusercontent.com/321db29717f45f21c26bc467a0622408d807ed34113a1e069094adf2c3bc4463/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f4a616d657348656d6572792f6c61726176656c2d757569642f436f6e74696e756f7573253230496e746567726174696f6e2e7376673f7374796c653d666f722d7468652d6261646765)](https://github.com/JamesHemery/laravel-uuid/actions?query=workflow%3A%22Continuous+Integration%22)[![Total Downloads](https://camo.githubusercontent.com/10f550ad580b682f8550e8ad0a1875cb35ab0201debfa78651ed1181dc0109c3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a616d6573682f6c61726176656c2d757569642e7376673f7374796c653d666f722d7468652d6261646765)](https://packagist.org/packages/jamesh/laravel-uuid)[![MIT licensed](https://camo.githubusercontent.com/31e62e0eff03ce9ddfdf69d8476340d4f541990bfb152cb02a0f342965252997/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666f722d7468652d6261646765)](https://raw.githubusercontent.com/JamesHemery/laravel-uuid/master/LICENSE)

The HasUuid Trait will add behavior to creating and saving Eloquent events for generate an Uuid.

Installation
------------

[](#installation)

```
composer require jamesh/laravel-uuid

```

Usage
-----

[](#usage)

#### In your migrations

[](#in-your-migrations)

```
Schema::create('users', function (Blueprint $table) {
    $table->uuid('id')->primary(); // Create CHAR(36)
    $table->string('name');
    $table->string('email')->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
});
```

#### In your models

[](#in-your-models)

```
