I\'m trying to create tables that will have a primary key which is a UUID defined as binary(16)
instead of the default auto-incrementing id
field.<
This is a quick solution without using events.
UUidModel.php
getKeyName();
$id = $attributes[$keyName] = $this->generateNewId();
$query->insert($attributes);
$this->setAttribute($keyName, $id);
}
/**
* Get a new version 4 (random) UUID.
*/
public function generateNewId()
{
return 'uuid!!' ;// just for test
}
}
?>
Model Example Car.php