I was doing a research on how to create this 3 elements, I already have 1 website, but I will have a form that will fill the information of store and store view.
I found this question https://community.magento.com/t5/Magento-2-x-Programming/Magento-2-How-to-create-website-Store-Store-view-Root-Category/td-p/87236 but I have no idea where to put that code.
For example this code for creating an store:
private function createOrUpdateGroup($groupId, $websiteId, $storeName, $storeCode)
{
$group = $this->groupFactory->create();
if($groupId)
$group->load($groupId);
$group->setWebsiteId($websiteId);
$group->setName($storeName);
$group->setCode($storeCode);
$group->save();
return $group;
}
Am I supposed to add this private method in the controller where I'm going to submit the form?
Greetings!