PHPackages                             laravolt/eloquent-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. laravolt/eloquent-uuid

ActiveLibrary[Database &amp; ORM](/categories/database)

laravolt/eloquent-uuid
======================

Universally Unique Identifier (UUID) for Laravel Eloquent

0.1.0(10y ago)81.3k2MITPHPPHP &gt;=5.5.0

Since Nov 19Pushed 9y ago2 watchersCompare

[ Source](https://github.com/laravolt/eloquent-uuid)[ Packagist](https://packagist.org/packages/laravolt/eloquent-uuid)[ Docs](https://github.com/laravolt/eloquent-uuid)[ RSS](/packages/laravolt-eloquent-uuid/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Universally Unique Identifier (UUID) for Laravel Eloquent
=========================================================

[](#universally-unique-identifier-uuid-for-laravel-eloquent)

Generate UUID automatically when creating/inserting new data.

Install
-------

[](#install)

Via Composer

```
$ composer require laravolt/eloquent-uuid
```

Then register the service provider, head over your `config/app.php` file and add the following line into the `providers` array:

```
Laravolt\Database\Eloquent\UuidServiceProvider::class,
```

Usage
-----

[](#usage)

### Create/Alter Database Table Column Type

[](#createalter-database-table-column-type)

```
Schema::create('users', function (Blueprint $table) {

    // Create UUID column
    $table->char('id', 32)->primary();

    $table->string('name');
});
```

### Implement in Eloquent Model

[](#implement-in-eloquent-model)

```
