marquine/eloquent-uuid

Uuid primary key for Laravel Eloquent Models
11,449 7
Install
composer require marquine/eloquent-uuid
Latest Version:v1.2.0
License:MIT
Last Updated:Mar 11, 2020
Links: GitHub  ·  Packagist
Maintainer: leomarquine

Eloquent UUID

Uuid primary key for Laravel Eloquent Models.

Installation

Install through Composer

composer require marquine/eloquent-uuid

Usage

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

Use the Uuid trait in your model:

<?php

namespace App;

use Marquine\EloquentUuid\Uuid;
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    use Uuid;
}

License

Eloquent UUID is licensed under the MIT license.

Related Packages

eig/eloquent-uuid

Easy UUID for Eloquent Models

1,568 59
gbuckingham89/eloquent-uuid

A simple package for using UUID's (UUID4) with Laravel's Eloquent.

4,787 1
dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

3,142,183 484
theprivateer/eloquent-uuid

UUID utility traits for Laravel

7,180 1
peach-schnapps/eloquent-uuid

Provides UUID Support for Laravel 4 Eloquent Models

6 2