healthengine / laravel-uuid
Use UUIDs as primary keys for Eloquent models
Installs: 26 392
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 1
Open Issues: 0
Requires
- illuminate/database: ~5.6|~6.0|>=7.0
- illuminate/support: ~5.6|~6.0|>=7.0
Requires (Dev)
- orchestra/testbench: ^3.7 || ^4.0 || ^5.0 || ^6.0
- phpunit/phpunit: ^7.5 || ^8.0 || ^9.0
This package is auto-updated.
Last update: 2023-05-24 02:07:51 UTC
README
Warning
This repository is archived.
Use laravel/framework instead.
Laravel UUID
This is a custom package designed for Laravel Eloquent. It provides a trait that can be used in model classes that will automatically generate a UUID primary key instead of the default auto-incrementing integer.
Usage
All that is necessary to have this working is to use
the trait in the model class. An example is shown below.
Don't forget that the migration will need to be changed to create a UUID (or string) column instead of an integer
column. You'll also need to explicitly set the column as the primary key.
use HealthEngine\LaravelUuid\UuidPrimaryKey; use Illuminate\Database\Eloquent\Model; class Post extends Model { use UuidPrimaryKey; // }
License
Laravel UUID is licensed under the MIT license.