title: Dynamically edit config/database.php file in Laravel
body: <p>First time when user runs my application i want to set database details as entered by the user in my application.</p>
  
  <p>Please let me know how i can edit config/database.php file in Laravel and update database credentials as provided by user.</p>
  
  <pre><code>'connections' =&gt; array(
  
      'mysql' =&gt; array(
          'driver'    =&gt; 'mysql',
          'host'      =&gt; '*********',
          'database'  =&gt; '********',
          'username'  =&gt; '********',
          'password'  =&gt; '*******',
          'charset'   =&gt; 'utf8',
          'collation' =&gt; 'utf8_unicode_ci',
          'prefix'    =&gt; '',
      ),
  ),
  </code></pre>