App\Repositories\Setting\ConfigAppSetting::update PHP Method

update() public method

public update ( array $data )
$data array
    public function update(array $data)
    {
        $this->writer->setConfig('APP_URL', $data['url']);
        return true;
    }

Usage Example

Example #1
0
 public function test_Should_UpdateExistingAppSettings()
 {
     vfsStream::newFile('.env')->at($this->rootDir);
     $dotenvReader = new DotenvReader(new LaravelFilesystem($this->app['files']), vfsStream::url('rootDir/.env'));
     $dotenvWriter = new DotenvWriter(new LaravelFilesystem($this->app['files']), vfsStream::url('rootDir/.env'));
     $configAppSettingRepository = new ConfigAppSetting($dotenvReader, $dotenvWriter);
     $configAppSettingRepository->update(['url' => 'http://example.com']);
     $this->assertEquals('http://example.com', $dotenvReader->getConfig('APP_URL'));
 }
ConfigAppSetting