title: MAMP with Laravel Unix Socket
body: <p>I'm working with MAMP on my local development server on my laravel application and I'm trying to figure out how I can safely setup my server so I don't have to use the following into the database connections mysql array because that should only be used when I'm on my development server. It works when I add the line into the mysql array however that isn't used if I was on a production server. Any ideas?</p>
  
  <pre><code>'unix_socket'   =&gt; '/Applications/MAMP/tmp/mysql/mysql.sock',
  </code></pre>
  
  <p>.env.development.php</p>
  
  <pre><code>&lt;?php
  
  return [
      'DB_HOST' =&gt; '127.0.0.1',
      'DB_USERNAME' =&gt; 'root',
      'DB_PASSWORD' =&gt; '1234',
      'DB_NAME' =&gt; 'mytable'
  ];
  </code></pre>
  
  <p>app/config/database.php</p>
  
  <pre><code>'connections' =&gt; array(
  
          'mysql' =&gt; array(
              'driver'    =&gt; 'mysql',
              'host'      =&gt; getenv('DB_HOST'),
              'database'  =&gt; getenv('DB_NAME'),
              'username'  =&gt; getenv('DB_USERNAME'),
              'password'  =&gt; getenv('DB_PASSWORD'),
              'charset'   =&gt; 'utf8',
              'collation' =&gt; 'utf8_unicode_ci',
              'prefix'    =&gt; '',
          ),
  </code></pre>