On duplicate form re-generate slug (#703)
* when duplicate remove removed_properties * when duplicate remove removed_properties * On duplicate form re-generate slug * On duplicate form re-generate slug
This commit is contained in:
@@ -185,6 +185,13 @@ class FormController extends Controller
|
|||||||
|
|
||||||
// Create copy
|
// Create copy
|
||||||
$formCopy = $form->replicate();
|
$formCopy = $form->replicate();
|
||||||
|
// generate new slug before changing title
|
||||||
|
if (Str::isUuid($formCopy->slug)) {
|
||||||
|
$formCopy->slug = Str::uuid();
|
||||||
|
} else { // it will generate a new slug
|
||||||
|
$formCopy->slug = null;
|
||||||
|
$formCopy->save();
|
||||||
|
}
|
||||||
$formCopy->title = 'Copy of ' . $formCopy->title;
|
$formCopy->title = 'Copy of ' . $formCopy->title;
|
||||||
$formCopy->removed_properties = [];
|
$formCopy->removed_properties = [];
|
||||||
$formCopy->save();
|
$formCopy->save();
|
||||||
|
|||||||
Reference in New Issue
Block a user