Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A simple way to write new Laravel config file dynamically | More info at https://simplestweb.in
<?php
$rawSettings = json_decode($request->get('settings'), true);
if ($rawSettings == null) abort(500);
config(['settings' => $rawSettings]);
$text = '<?php return ' . var_export(config('settings'), true) . ';';
file_put_contents(config_path('settings.php'), $text);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment