From bc92f7c38c268a58d343c726a62cc339a32abbc8 Mon Sep 17 00:00:00 2001 From: Radek Ziemniewicz Date: Tue, 4 Jan 2022 01:58:01 +0000 Subject: [PATCH] Updated README.md file --- README.md | 27 +++++++++++++++++++++++++++ docker/xdebug-local.ini | 1 - 2 files changed, 27 insertions(+), 1 deletion(-) delete mode 100644 docker/xdebug-local.ini diff --git a/README.md b/README.md index 05f296b..4da59cf 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,21 @@ class Book extends Model } ``` +The above example works for the column `id`. If you use custom name for UUID column, you need to define it: + +```php +use Illuminate\Database\Eloquent\Model; +use Verbanent\Uuid\Traits\BinaryUuidSupportableTrait; + +class Book extends Model +{ + use BinaryUuidSupportableTrait; + + protected $primaryKey = 'uuid'; + protected $fillable = ['uuid']; +} +``` + #### Abstract model for model with UUID For your convenience you can extend your model with _AbstractModel_: @@ -70,6 +85,18 @@ class Lang extends AbstractModel } ``` +The above example works for the column `id`. If you use custom name for UUID column, you need to define it: + +```php +use Verbanent\Uuid\AbstractModel; + +class Lang extends AbstractModel +{ + protected $primaryKey = 'uuid'; + protected $fillable = ['uuid']; +} +``` + #### Foreign binary UUID If you would like to use UUID as a foreign key, use another trait and set _$uuidable_ property for this model: diff --git a/docker/xdebug-local.ini b/docker/xdebug-local.ini deleted file mode 100644 index b2db12b..0000000 --- a/docker/xdebug-local.ini +++ /dev/null @@ -1 +0,0 @@ -xdebug.mode=coverage \ No newline at end of file