Using uuid
in eloquent model.
composer require xzxzyzyz/laravel-uuid-model
Create primary key as string type.
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('example', function(Blueprint $table) {
$table->uuid('id')->primary();
// ...
});
}
And, Extends Xzxzyzyz\Laravel\Uuid\Model
in your model.
use Xzxzyzyz\Laravel\Uuid\Model;
class Example extends Model
{
//...
}