You can easily swap between different databases/servers using Config::get and Config::set. I've managed to do it in those days! :)
$connections = Config::get('databases.connections.mysql'); $connections['host'] = "db.google.com"; $connections['database'] = "db2"; Config::set('database.connections.mysql', $connections);
I want when user writes him/her|self in a html form information about laravel mysql to rewrite in config folder the database settings for mysql from the form!
Yes, assuming php has permission to write files you can do this
elite123 said:
Yes, assuming php has permission to write files you can do this
More specifically, you'll have to rewrite the PHP file itself using 'file_put_contents' and then redirect the user, at which point the new DB settings will take effect.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community