desmart / laravel-uuid-id
Use UUIDs as IDs in Laravel models
1.0.0
2021-02-25 13:41 UTC
Requires
- php: ^7.4|^8.0
- illuminate/database: ^8.0
- illuminate/support: ^8.0
Requires (Dev)
- orchestra/testbench: ^6.13
- phpunit/phpunit: ^9.3.3
This package is auto-updated.
Last update: 2024-12-25 22:12:32 UTC
README
Package provides a simple trait that allows to use/generate UUIDs as IDs in Laravel models.
Installation
To install the package via Composer, simply run the following command:
composer require desmart/laravel-uuid-id
Usage
This package does two things:
- enables having UUID as an ID (by modifying some underlying Laravel model methods), and
- automatically generates ordered UUID as an ID during model creation.
In any Laravel model that should use UUID as an ID, add HasUuidId
trait:
class MyModel extends \Illuminate\Database\Eloquent\Model { use \DeSmart\Laravel\Uuid\HasUuidId; }
Changelog
Please see CHANGELOG for more information what has changed recently.
License
The MIT License (MIT). Please see License File for more information.