We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 30d3583 commit 4aaa029Copy full SHA for 4aaa029
api/app/Http/Controllers/Forms/FormController.php
@@ -185,6 +185,14 @@ public function duplicate($id)
185
186
// Create copy
187
$formCopy = $form->replicate();
188
+ // generate new slug before changing title
189
+ if (Str::isUuid($formCopy->slug)) {
190
+ $formCopy->slug = Str::uuid();
191
+ } else {
192
+ $formCopy->slug = null; // Reset the slug first
193
+ $formCopy->save(); // Save to ensure we have an ID
194
+ $formCopy->generateSlug(); // Now generate the slug
195
+ }
196
$formCopy->title = 'Copy of ' . $formCopy->title;
197
$formCopy->removed_properties = [];
198
$formCopy->save();
0 commit comments