- PHP 7.2 or latest
- Laravel 6.* | 7.* | 8.*
Require this package with composer using the following command:
composer require larastuffs/primary-uuid
Follow the instructions to adapt your models and migrations
<?php
use ...;
use LaraStuffs\PrimaryUUID\Eloquent\Concerns\UseUUIDAsPrimaryKey;
class MyModel extends Model {
use UseUUIDAsPrimaryKey;
...
}
<?php
Schema::create('table_name', function (Blueprint $table) {
$table->uuid('id')->primary();
});
if you use closures to define your model events, I strongly recommend that you use model observers instead
Contributions are more than welcome. Fork, improve and make a pull request. For bugs, ideas for improvement or other, please create an issue.