danielcosta / eloquent-uuid
This package is abandoned and no longer maintained.
The author suggests using the alsofronie/eloquent-uuid package instead.
Eloquent UUID Model
1.1.1
2017-03-15 00:58 UTC
Requires
- php: >=5.5
- illuminate/database: ^5.2
- ramsey/uuid: ~3.0
This package is not auto-updated.
Last update: 2019-02-20 18:55:56 UTC
README
If you want your eloquent models to have the primary key as an UUID instead of the default incremental integer, you must use this abstract model on top of your models to convert them to an Eloquent UUID Model.
Install
Just require this package within your composer:
composer require danielcosta/eloquent-uuid:^1.0
Sample usage
Using Eloquent UUID Model is as simple as just extending the abstract UUIDEloquentModel
.
use DCST\Database\Eloquent\Models\UUIDEloquentModel; class Product extends UUIDEloquentModel { // your class model } $product = new Product; $product->name = 'My Awesome Product'; $product->save(); var_dump($product->id); // 55d53549-e772-4765-9467-5a75d33cbf6a