mirror of
https://github.com/archtechx/tenancy.git
synced 2026-02-06 06:14:04 +00:00
method rename
This commit is contained in:
parent
5aa8231c81
commit
4245f46bc1
4 changed files with 12 additions and 12 deletions
|
|
@ -16,5 +16,5 @@ interface Syncable
|
|||
|
||||
public function triggerSyncEvent(): void;
|
||||
|
||||
public function getResourceCreationAttributes(): array|null; // todo come up with a better name
|
||||
public function getCreationAttributes(): array|null; // todo come up with a better name
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ trait ResourceSyncing
|
|||
event(new SyncedResourceSaved($this, tenant()));
|
||||
}
|
||||
|
||||
public function getResourceCreationAttributes(): array|null
|
||||
public function getCreationAttributes(): array|null
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,18 +123,18 @@ class UpdateSyncedResource extends QueueableListener
|
|||
|
||||
protected function getAttributesForCreation(Syncable $model): array
|
||||
{
|
||||
if (! $model->getResourceCreationAttributes()) {
|
||||
if (! $model->getCreationAttributes()) {
|
||||
// Creation attributes are not specified so create the model as 1:1 copy
|
||||
return $model->getAttributes();
|
||||
}
|
||||
|
||||
if (Arr::isAssoc($model->getResourceCreationAttributes())) {
|
||||
if (Arr::isAssoc($model->getCreationAttributes())) {
|
||||
// Developer provided the default values
|
||||
// We will merge the default values with sync attributes
|
||||
return array_merge($model->getResourceCreationAttributes(), $model->only($model->getSyncedAttributeNames()));
|
||||
return array_merge($model->getCreationAttributes(), $model->only($model->getSyncedAttributeNames()));
|
||||
}
|
||||
|
||||
// Developer provided the attribute names, so we'd use them to pick model attributes
|
||||
return $model->only($model->getResourceCreationAttributes());
|
||||
return $model->only($model->getCreationAttributes());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue