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

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

marquine/eloquent-uuid
======================

Uuid primary key for Laravel Eloquent Models

v1.2.0(6y ago)711.4k11MITPHPCI failing

Since Sep 24Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (7)Used By (1)

Eloquent UUID
=============

[](#eloquent-uuid)

Uuid primary key for Laravel Eloquent Models.

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

[](#installation)

Install through Composer

```
composer require marquine/eloquent-uuid

```

Usage
-----

[](#usage)

### Database table

[](#database-table)

In your migration, create a column for the uuid primary key:

```
$table->uuid('id')->primary();
```

or

```
$table->string('id', 32)->primary();
```

If your primary key column name is not `id`, you need to set the model's `$primaryKey` property to the correct name.

### Model

[](#model)

Use the Uuid trait in your model:

```
