fixed recurring cloneable relations type

This commit is contained in:
Cihan Şentürk 2025-04-22 19:55:33 +03:00 committed by GitHub
parent 09e32ad262
commit 84ee8b123a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -218,6 +218,8 @@ class RecurringCheck extends Command
$model->created_from = 'core::recurring';
$model->save();
$this->updateRelationTypes($model, $template->cloneable_relations);
return $model;
}
@ -233,6 +235,8 @@ class RecurringCheck extends Command
$model->created_from = 'core::recurring';
$model->save();
$this->updateRelationTypes($model, $template->cloneable_relations);
return $model;
}
@ -266,4 +270,15 @@ class RecurringCheck extends Command
{
return Str::replace('-recurring', '', $recurring_type);
}
public function updateRelationTypes($model, $relations)
{
foreach ($relations as $relation) {
if (! method_exists($model, $relation)) {
continue;
}
$model->$relation()->update(['type' => $model->type]);
}
}
}