File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,24 @@ class User extends Authenticatable
8888}
8989```
9090
91+ ### Generating UUIDs
92+
93+ If you don't specify the value for the primary key of your model, a UUIDv4 will
94+ be automatically generated. However, if you do specify your own UUIDv4 then it
95+ will not generate one, but instead use the one you have explicity provided. This
96+ can be useful when needing the know the ID of the model before you have created
97+ it:
98+
99+ ``` php
100+ // No UUID provided (automatically generated).
101+ $model = Model::create();
102+ echo $model->id; // abb034ae-fcdc-4200-8094-582b60a4281f
103+
104+ // UUID explicity provided.
105+ $model = Model::create(['id' => '04d7f995-ef33-4870-a214-4e21c51ff76e']);
106+ echo $model->id; // 04d7f995-ef33-4870-a214-4e21c51ff76e
107+ ```
108+
91109## Running the tests
92110
93111To run the test suite you can use the following commands:
You can’t perform that action at this time.
0 commit comments