Support the ongoing development of Laravel.io →
Configuration Database Forms
Last updated 3 months ago.
0

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);

Last updated 3 months ago.
0

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!

Last updated 3 months ago.
0

Is this possible?

Last updated 3 months ago.
0

Yes, assuming php has permission to write files you can do this

Last updated 3 months ago.
0

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.

Last updated 3 months ago.
0

Sign in to participate in this thread!

Cloudways

Your banner here too?

rizaado rizaado rizaado Joined 23 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.