mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 00:04:03 +00:00
854 - possible resolve deprecation issue
This commit is contained in:
parent
84a3287799
commit
cea10b2f2d
3 changed files with 10 additions and 6 deletions
|
|
@ -16,7 +16,7 @@ trait BelongsToTenant
|
|||
|
||||
public function tenant()
|
||||
{
|
||||
return $this->belongsTo(config('tenancy.tenant_model'), BelongsToTenant::$tenantIdColumn);
|
||||
return $this->belongsTo(config('tenancy.tenant_model'), self::$tenantIdColumn);
|
||||
}
|
||||
|
||||
public static function bootBelongsToTenant()
|
||||
|
|
@ -24,9 +24,9 @@ trait BelongsToTenant
|
|||
static::addGlobalScope(new TenantScope);
|
||||
|
||||
static::creating(function ($model) {
|
||||
if (! $model->getAttribute(BelongsToTenant::$tenantIdColumn) && ! $model->relationLoaded('tenant')) {
|
||||
if (! $model->getAttribute(self::$tenantIdColumn) && ! $model->relationLoaded('tenant')) {
|
||||
if (tenancy()->initialized) {
|
||||
$model->setAttribute(BelongsToTenant::$tenantIdColumn, tenant()->getTenantKey());
|
||||
$model->setAttribute(self::$tenantIdColumn, tenant()->getTenantKey());
|
||||
$model->setRelation('tenant', tenant());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue