File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,21 @@ class Book extends Model
57
57
}
58
58
```
59
59
60
+ The above example works for the column ` id ` . If you use custom name for UUID column, you need to define it:
61
+
62
+ ``` php
63
+ use Illuminate\Database\Eloquent\Model;
64
+ use Verbanent\Uuid\Traits\BinaryUuidSupportableTrait;
65
+
66
+ class Book extends Model
67
+ {
68
+ use BinaryUuidSupportableTrait;
69
+
70
+ protected $primaryKey = 'uuid';
71
+ protected $fillable = ['uuid'];
72
+ }
73
+ ```
74
+
60
75
#### Abstract model for model with UUID
61
76
62
77
For your convenience you can extend your model with _ AbstractModel_ :
@@ -70,6 +85,18 @@ class Lang extends AbstractModel
70
85
}
71
86
```
72
87
88
+ The above example works for the column ` id ` . If you use custom name for UUID column, you need to define it:
89
+
90
+ ``` php
91
+ use Verbanent\Uuid\AbstractModel;
92
+
93
+ class Lang extends AbstractModel
94
+ {
95
+ protected $primaryKey = 'uuid';
96
+ protected $fillable = ['uuid'];
97
+ }
98
+ ```
99
+
73
100
#### Foreign binary UUID
74
101
75
102
If you would like to use UUID as a foreign key, use another trait and set _ $uuidable_ property for this model:
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments