Mayowa Emmanuel Oludare 1 hour ago· 1 min readHow to Set Database Configuration Dynamically in your Laravel Application. Sometimes we may find ourselves in situations where we have to modify our database connection/configuration at runtime. Some applications require alot of database and sometimes the required database can only be determined at runtime. A typical example from my experience was in School Management System that required a separate Database for each school.
A better approach is to only modify only the configuration array key of interest, in this case the database name of your mysql connection.