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
5757}
5858```
5959
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+
6075#### Abstract model for model with UUID
6176
6277For your convenience you can extend your model with _ AbstractModel_ :
@@ -70,6 +85,18 @@ class Lang extends AbstractModel
7085}
7186```
7287
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+
73100#### Foreign binary UUID
74101
75102If 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