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:
parent
33bd85fd2c
commit
c819e76463
|
|
@ -185,6 +185,13 @@ class FormController extends Controller
|
|||
|
||||
// Create copy
|
||||
$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->removed_properties = [];
|
||||
$formCopy->save();
|
||||
|
|
|
|||
Loading…
Reference in New Issue