From 3fa3d6fc3de7650f76e105ee81e8c6c1618081e2 Mon Sep 17 00:00:00 2001 From: Wouter van Dongen Date: Sat, 28 Dec 2019 22:06:38 +0100 Subject: [PATCH] Set primary key type to string. --- src/Uuid32ModelTrait.php | 10 ++++++++++ src/UuidModelTrait.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/src/Uuid32ModelTrait.php b/src/Uuid32ModelTrait.php index 3da6fec..ac02876 100644 --- a/src/Uuid32ModelTrait.php +++ b/src/Uuid32ModelTrait.php @@ -22,6 +22,16 @@ public function getIncrementing() return false; } + /** + * This function is used internally by Eloquent models to set the data type for the primary key. + * + * @return string Always string + */ + public function getkeyType() + { + return 'string'; + } + /** * This function overwrites the default boot static method of Eloquent models. It will hook * the creation event with a simple closure to insert the UUID diff --git a/src/UuidModelTrait.php b/src/UuidModelTrait.php index bf24d98..7720ad8 100644 --- a/src/UuidModelTrait.php +++ b/src/UuidModelTrait.php @@ -21,6 +21,16 @@ public function getIncrementing() return false; } + /** + * This function is used internally by Eloquent models to set the data type for the primary key. + * + * @return string Always string + */ + public function getkeyType() + { + return 'string'; + } + /** * This function overwrites the default boot static method of Eloquent models. It will hook * the creation event with a simple closure to insert the UUID