mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 08:14:02 +00:00
Modified GeneratesIds.php
When overwriting `getTenantKeyName()` to use another column, an exception occurs when creating new tenants. (Field 'id' doesn't have a default value). This fixes the issue.
This commit is contained in:
parent
a002f59420
commit
cffdb3e57d
1 changed files with 2 additions and 2 deletions
|
|
@ -11,8 +11,8 @@ trait GeneratesIds
|
||||||
public static function bootGeneratesIds()
|
public static function bootGeneratesIds()
|
||||||
{
|
{
|
||||||
static::creating(function (self $model) {
|
static::creating(function (self $model) {
|
||||||
if (! $model->getTenantKey() && $model->shouldGenerateId()) {
|
if (!$model->getKey() && $model->shouldGenerateId()) {
|
||||||
$model->setAttribute($model->getTenantKeyName(), app(UniqueIdentifierGenerator::class)->generate($model));
|
$model->setAttribute($model->getKeyName(), app(UniqueIdentifierGenerator::class)->generate($model));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue