Skip to content

Commit

Permalink
Removed the UUID code.
Browse files Browse the repository at this point in the history
  • Loading branch information
kirkbushell committed Aug 26, 2023
1 parent ca0306a commit d7c5ffb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 80 deletions.
35 changes: 4 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,37 +46,6 @@ Eloquence DOES NOT CHANGE how you write your schema migrations. You should still
when setting up your fields and tables in your database schema migrations. This is a good thing -
snake_case of field names is the defacto standard within the Laravel community :)


## UUIDs

Eloquence comes bundled with UUID capabilities that you can use in your models.

Simply include the Uuid trait:

use Eloquence\Behaviours\Uuid;

And then disable auto incrementing ids:

public $incrementing = false;

This will turn off id auto-incrementing in your model, and instead automatically generate a UUID4 value for your id field. One
benefit of this is that you can actually know the id of your record BEFORE it's saved!

You must ensure that your id column is setup to handle UUID values. This can be done by creating a migration with the following
properties:

$table->char('id', $length = 36)->index();

It's important to note that you should do your research before using UUID functionality and whether it works for you. UUID
field searches are much slower than indexed integer fields (such as autoincrement id fields).


### Custom UUIDs

Should you need a custom UUID solution (aka, maybe you don't want to use a UUID4 id), you can simply define the value you wish on
the id field. The UUID model trait will not set the id if it has already been defined. In this use-case however, it's probably no good
to use the Uuid trait, as it's practically useless in this scenario.

## Behaviours

Eloquence comes with a system for setting up behaviours, which are really just small libraries that you can use with your Eloquent models.
Expand Down Expand Up @@ -262,6 +231,10 @@ That's it! Easy huh?

## Changelog

#### 11.0.0

* UUID support removed - both UUIDs and ULIDs are now natively supported in Laravel

#### 10.0.0

* Boost in version number to match Laravel
Expand Down
47 changes: 0 additions & 47 deletions src/Behaviours/Uuid.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Database/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
namespace Eloquence\Database;

use Eloquence\Behaviours\CamelCasing;
use Eloquence\Behaviours\Uuid;

/**
* Class Model
Expand All @@ -14,5 +13,4 @@
abstract class Model extends \Illuminate\Database\Eloquent\Model
{
use CamelCasing;
use Uuid;
}

0 comments on commit d7c5ffb

Please sign in to comment.