You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 10, 2018. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+5-3Lines changed: 5 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,19 +36,21 @@ Schema::create('table_name', function (Blueprint $table) {
36
36
});
37
37
```
38
38
39
-
To get your model to work with the encoded UUID (i.e. to use uuid as a primary key), you must let your model use the `Spatie\BinaryUuid\HasBinaryUuid`trait.
39
+
To get your model to work with the encoded UUID (i.e. to use uuid as a primary key), you must let your model use the `Spatie\BinaryUuid\HasBinaryUuid`and the `Spatie\BinaryUuid\HasUuidPrimaryKey` traits.
40
40
41
41
```php
42
42
use Illuminate\Database\Eloquent\Model;
43
43
use Spatie\BinaryUuid\HasBinaryUuid;
44
+
use Spatie\BinaryUuid\HasUuidPrimaryKey;
44
45
45
46
class TestModel extends Model
46
47
{
47
-
use HasBinaryUuid;
48
+
use HasBinaryUuid,
49
+
HasUuidPrimaryKey;
48
50
}
49
51
```
50
52
51
-
If don't like the primary key named `uuid` you can manually specify `$primaryKey`. Don't forget set `$incrementing` to false.
53
+
If don't like the primary key named `uuid` you can leave off the `HasUuidPrimaryKey` trait and manually specify `$primaryKey`. Don't forget set `$incrementing` to false.
0 commit comments