Skip to content

Commit

Permalink
Merge pull request #12 from verbanent/update/readme
Browse files Browse the repository at this point in the history
Updated README.md file
  • Loading branch information
radek-ziemniewicz authored Jan 4, 2022
2 parents ff4edb8 + bc92f7c commit 47a45bd
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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_:
Expand All @@ -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:
Expand Down
1 change: 0 additions & 1 deletion docker/xdebug-local.ini

This file was deleted.

0 comments on commit 47a45bd

Please sign in to comment.