glorand / laravel-eloquent-model-uuid
A simple solution for providing UUID support for the IDs of your Eloquent models.
Installs: 1 021
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 4
Requires
- php: >=7.1.3
- illuminate/database: ~5.8.0|^6.0|^7.0|^8.0|^9.0
- illuminate/support: ~5.8.0|^6.0|^7.0|^8.0|^9.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16@dev|^3.6
- orchestra/testbench: ~3.8.0|^4.0|^5.0|^7.0
- phpunit/phpunit: ^7.5|^8.0|^9.0
This package is auto-updated.
Last update: 2024-11-19 20:37:28 UTC
README
A simple solution for providing UUID support for the IDs of your Eloquent models.
Installation
You can install the package via composer:
composer require glorand/laravel-eloquent-model-uuid
Usage
Let us start on the database side of things.
$table->uuid('id'); $table->primary('id'); //OR $table->uuid('id')->primary();
Use model class provided by this package
Instead of extending the standard Laravel model class, extend from the model class provided by this package:
<?php use Glorand\LaravelEloquentModelUuid\Database\Eloquent\Model; class Entity extends Model { // }
Use Trait on model class:
<?php use Illuminate\Database\Eloquent\Model; use Glorand\LaravelEloquentModelUuid\Database\Concerns\Uuid; class Entity extends Model { use Uuid; /** * The "type" of the auto-incrementing ID. * * @var string */ protected $keyType = 'string'; /** * Indicates if the IDs are auto-incrementing. * * @var bool */ public $incrementing = false; // }
Testing
composer test
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email gombos.lorand@gmail.com instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.