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-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,21 +36,19 @@ 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`and the `Spatie\BinaryUuid\HasUuidPrimaryKey` traits.
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.
40
40
41
41
```php
42
42
use Illuminate\Database\Eloquent\Model;
43
43
use Spatie\BinaryUuid\HasBinaryUuid;
44
-
use Spatie\BinaryUuid\HasUuidPrimaryKey;
45
44
46
45
class TestModel extends Model
47
46
{
48
-
use HasBinaryUuid,
49
-
HasUuidPrimaryKey;
47
+
use HasBinaryUuid;
50
48
}
51
49
```
52
50
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.
51
+
If don't like the primary key named `uuid` you can manually specify `$primaryKey`. Don't forget set `$incrementing` to false.
54
52
55
53
```php
56
54
use Illuminate\Database\Eloquent\Model;
@@ -99,10 +97,10 @@ In your JSON you will see `uuid` and `country_uuid` in their textual representat
99
97
100
98
#### A note on the `uuid` blueprint method
101
99
102
-
Laravel currently doesn't allow adding new blueprint methods which can be used out of the box.
100
+
Laravel currently does not allow adding new blueprint methods which can be used out of the box.
103
101
Because of this, we decided to override the `uuid` behaviour which will create a `BINARY` column instead of a `CHAR(36)` column.
104
102
105
-
There are some cases in which Laravel's generated code will also use `uuid`, but doesn't support our binary implementation.
103
+
There are some cases in which Laravel's generated code will also use `uuid`, but does not support our binary implementation.
106
104
An example are database notifications.
107
105
To make those work, you'll have to change the migration of those notifications to use `CHAR(36)`.
0 commit comments