afaanbilal / laravel-has-uuid
Autogenerate UUIDs for your Models on insert and set the route-model-binding key to uuid.
Installs: 1 103
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/afaanbilal/laravel-has-uuid
Requires
- ramsey/uuid: ^4.7
This package is auto-updated.
Last update: 2025-10-27 20:12:18 UTC
README
Author: Afaan Bilal
Introduction
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();
Installation
composer require afaanbilal/laravel-has-uuid
Usage
// In any model: use AfaanBilal\LaravelHasUUID\HasUUID; // ... class Post extends Model { use HasUUID; // ... }
Contributing
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!
License
Laravel HasUUID is released under the MIT License. Check out the full license here.