mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-05 12:54:05 +00:00
Renamed method from isSyncEnabled to shouldSync
This commit is contained in:
parent
d34a6dcd7d
commit
a7a8a5f5e3
4 changed files with 6 additions and 6 deletions
|
|
@ -16,5 +16,5 @@ interface Syncable
|
||||||
|
|
||||||
public function triggerSyncEvent();
|
public function triggerSyncEvent();
|
||||||
|
|
||||||
public function isSyncEnabled();
|
public function shouldSync(): bool;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ trait ResourceSyncing
|
||||||
{
|
{
|
||||||
static::saved(function (Syncable $model) {
|
static::saved(function (Syncable $model) {
|
||||||
/** @var ResourceSyncing $model */
|
/** @var ResourceSyncing $model */
|
||||||
if ($model->isSyncEnabled()) {
|
if ($model->shouldSync()) {
|
||||||
$model->triggerSyncEvent();
|
$model->triggerSyncEvent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -34,7 +34,7 @@ trait ResourceSyncing
|
||||||
event(new SyncedResourceSaved($this, tenant()));
|
event(new SyncedResourceSaved($this, tenant()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSyncEnabled()
|
public function shouldSync(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ class TenantPivot extends Pivot
|
||||||
static::saved(function (self $pivot) {
|
static::saved(function (self $pivot) {
|
||||||
$parent = $pivot->pivotParent;
|
$parent = $pivot->pivotParent;
|
||||||
|
|
||||||
if ($parent instanceof Syncable && $parent->isSyncEnabled()) {
|
if ($parent instanceof Syncable && $parent->shouldSync()) {
|
||||||
$parent->triggerSyncEvent();
|
$parent->triggerSyncEvent();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -682,7 +682,7 @@ class CentralUser extends Model implements SyncMaster
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isSyncEnabled()
|
public function shouldSync()
|
||||||
{
|
{
|
||||||
return $this->role !== 'not_sync';
|
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';
|
return $this->role !== 'not_sync';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue