I tried to add Home Page URL key programmatically using Recurring.php
Normally from Magento Admin backend:
STORES -> GENERAL -> Web -> Default Pages -> Default Web URL:
I tried using
Vendor/Module/Setup/Recurring.php
<?php
namespace Vendor\Module\Setup;
use Magento\Framework\Setup\InstallSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
class Recurring implements InstallSchemaInterface
{
const default_web_url = 'cms';
protected $_configInterface;
/**
* @var \Magento\Framework\App\Config\Storage\WriterInterface
*/
protected $configWriter;
/**
*
* @param \Magento\Framework\App\Config\Storage\WriterInterface $configWriter
*/
public function __construct(
\Magento\Framework\App\Config\Storage\WriterInterface $configWriter
) {
$this->configWriter = $configWriter;
}
public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$value = self::default_web_url;
$this->configWriter->save('web/default/front', $value, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeId = 0);
}
}
In my local, this value is storing for all store view scopes($scopeId = 0
) but in our server, it's setting value for only one store view.
This is the issue I am facing here if anyone having any idea please guide me.
Thanks in Advance !!!!.