@@ -28,6 +28,14 @@ composer require verbanent/eloquent-binary-uuid
2828
2929Your model will use an ordered binary UUID, if you prepare a migration:
3030
31+ ``` php
32+ Schema::create('table_name', function (Blueprint $table) {
33+ $table->uuid('id');
34+ });
35+ ```
36+
37+ Or if you want to use a custom column name for the primary key:
38+
3139``` php
3240Schema::create('table_name', function (Blueprint $table) {
3341 $table->uuid('uuid');
@@ -58,7 +66,7 @@ use Verbanent\Uuid\AbstractModel;
5866
5967class Lang extends AbstractModel
6068{
61-
69+ //
6270}
6371```
6472
@@ -95,6 +103,11 @@ dd($book->uuid());
95103or use a property, if you need a binary value:
96104
97105``` php
106+ # If you use the default primary key:
107+ dd($book->id);
108+ // Output: b"\x11éGù¡½øDˆØ`0ÔƒÅþ"
109+
110+ # If you use `uuid` as a primary key:
98111dd($book->uuid);
99112// Output: b"\x11éGù¡½øDˆØ`0ÔƒÅþ"
100113```
@@ -131,9 +144,23 @@ dd($translation->foreignUuid('lang'));
131144// Output: "11e947f9-a1bd-f844-88d8-6030d483c5fe"
132145```
133146
134- Because trying to have an access to the property directly will print binary form of UUID:
147+ Because trying to have access to the property directly will print binary form of UUID:
135148
136149``` php
137150dd($translation->lang);
138151// Output: b"\x11éGù¡½øDˆØ`0ÔƒÅþ"
139152```
153+
154+ ## Unit tests
155+
156+ Run this command if you want to check unit tests:
157+
158+ ``` shell
159+ ./vendor/bin/phpunit
160+ ```
161+
162+ Or if you want to check code coverage:
163+
164+ ``` shell
165+ phpdbg -qrr vendor/bin/phpunit --coverage-html coverage tests
166+ ```
0 commit comments