File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ The uuid trait automatically generates uuids for your Eloquent models.
10
10
- [ Primary Key] ( #primary-key )
11
11
- [ Custom Column] ( #custom-column )
12
12
- [ Scope] ( #scope )
13
+ - [ String Based UUIDs] ( #string-based-uuids )
13
14
14
15
## Usage
15
16
@@ -75,4 +76,29 @@ The trait provides a convenient scope for finding models based on the uuid colum
75
76
'5785e0eb-155f-4c25-9e1a-c123a29a0cd8',
76
77
'041f681f-9c9b-4ca4-b623-fb9928490e8c',
77
78
'93b1e345-b262-4bc7-ad41-034f755a00c3',
78
- ] )->get()`
79
+ ] )->get()`
80
+
81
+ ## String Based UUIDs
82
+
83
+ > ⚠️ String based UUIDs are consistently slower on any size dataset. Use this at your own caution ⚠️
84
+
85
+ Usage is identical to the ` BinaryUuid ` trait with two differences.
86
+
87
+ 1 . You should use the ` uuid ` type provided by Laravel. This creates a char column type with a length of 36.
88
+ 2 . There is no ` uuid_text ` attribute, only ` uuid `
89
+
90
+ ``` php
91
+ Schema::table('users', function (Blueprint $table)
92
+ {
93
+ $table->uuid('uuid');
94
+ });
95
+ ```
96
+
97
+ ``` php
98
+ use Laratools\Eloquent\Uuid;
99
+
100
+ class User extends Model
101
+ {
102
+ use Uuid;
103
+ }
104
+ ```
You can’t perform that action at this time.
0 commit comments