Autogenerate UUIDs for your Models on insert and set the route-model-binding key to uuid.
afaanbilal/laravel-has-uuid is a Laravel package for autogenerate uuids for your models on insert and set the route-model-binding key to uuid..
It currently has 1 GitHub stars and 1.409 downloads on Packagist (latest version 0.1.3).
Install it with composer require afaanbilal/laravel-has-uuid.
Discover more Laravel packages by afaanbilal
or browse all Laravel packages to compare alternatives.
Last updated
Author: Afaan Bilal
Laravel HasUUID is a package for Laravel to autogenerate UUIDs for your Models on insert and set the route-model-binding key to uuid.
Also adds a fromUUID method to your Model which accepts a uuid and returns a model instance if found, or null otherwise.
Please make sure that you have column in your table called uuid which is a unique index.
Example (in migration):
$table->string('uuid')->unique();
composer require afaanbilal/laravel-has-uuid
// In any model:
use AfaanBilal\LaravelHasUUID\HasUUID;
// ...
class Post extends Model
{
use HasUUID;
// ...
}
All contributions are welcome. Please create an issue first for any feature request or bug. Then fork the repository, create a branch and make any changes to fix the bug or add the feature and create a pull request. That's it! Thanks!
Laravel HasUUID is released under the MIT License. Check out the full license here.