Devise\Templates\TemplatesCleaner::clearTemplateFields PHP Method

clearTemplateFields() public method

removes all fields and collection from database
public clearTemplateFields ( string $templateName ) : void
$templateName string
return void
    public function clearTemplateFields($templateName)
    {
        DB::beginTransaction();
        try {
            $page = $this->fakeAPageRender($templateName);
            $keys = $this->getActiveKeys();
            $allIds = $this->getIdsToDelete($templateName, $keys, $page->version->id);
            $this->deleteFields($allIds['fields']);
            $this->deleteCollectionInstances($allIds['collection_instances']);
            $this->deleteCollections($allIds['collections']);
        } catch (\Exception $e) {
            // if anything guest wrong, rollback the database changes.
            DB::rollback();
            throw $e;
        }
        DB::commit();
        return true;
    }