1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2026-02-05 14:14:03 +00:00

Renamed method from isSyncEnabled to shouldSync

This commit is contained in:
Leandro Guindani Gehlen 2022-12-21 10:07:19 -03:00
parent d34a6dcd7d
commit a7a8a5f5e3
4 changed files with 6 additions and 6 deletions

View file

@ -16,5 +16,5 @@ interface Syncable
public function triggerSyncEvent();
public function isSyncEnabled();
public function shouldSync(): bool;
}

View file

@ -14,7 +14,7 @@ trait ResourceSyncing
{
static::saved(function (Syncable $model) {
/** @var ResourceSyncing $model */
if ($model->isSyncEnabled()) {
if ($model->shouldSync()) {
$model->triggerSyncEvent();
}
});
@ -34,7 +34,7 @@ trait ResourceSyncing
event(new SyncedResourceSaved($this, tenant()));
}
public function isSyncEnabled()
public function shouldSync(): bool
{
return true;
}

View file

@ -16,7 +16,7 @@ class TenantPivot extends Pivot
static::saved(function (self $pivot) {
$parent = $pivot->pivotParent;
if ($parent instanceof Syncable && $parent->isSyncEnabled()) {
if ($parent instanceof Syncable && $parent->shouldSync()) {
$parent->triggerSyncEvent();
}
});

View file

@ -682,7 +682,7 @@ class CentralUser extends Model implements SyncMaster
];
}
public function isSyncEnabled()
public function shouldSync()
{
return $this->role !== 'not_sync';
}
@ -720,7 +720,7 @@ class ResourceUser extends Model implements Syncable
];
}
public function isSyncEnabled()
public function shouldSync()
{
return $this->role !== 'not_sync';
}