Advertisement
Guest User

Untitled

a guest
Mar 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.16 KB | None | 0 0
  1. <?php
  2.  
  3. $url = parse_url(getenv("DATABASE_URL"));
  4.  
  5. $server = $url["host"];
  6. $port = $url["port"];
  7. $db = ltrim($url["path"], "/");
  8. $username = $url["user"];
  9. $password = $url["pass"];
  10.  
  11.  
  12. return [
  13.  
  14.     /*
  15.     |--------------------------------------------------------------------------
  16.     | Default Database Connection Name
  17.     |--------------------------------------------------------------------------
  18.     |
  19.     | Here you may specify which of the database connections below you wish
  20.     | to use as your default connection for all database work. Of course
  21.     | you may use many connections at once using the Database library.
  22.     |
  23.     */
  24.  
  25.     'default' => env('DB_CONNECTION', 'pgsql'),
  26.  
  27.     /*
  28.     |--------------------------------------------------------------------------
  29.     | Database Connections
  30.     |--------------------------------------------------------------------------
  31.     |
  32.     | Here are each of the database connections setup for your application.
  33.     | Of course, examples of configuring each database platform that is
  34.     | supported by Laravel is shown below to make development simple.
  35.     |
  36.     |
  37.     | All database work in Laravel is done through the PHP PDO facilities
  38.     | so make sure you have the driver for your particular database of
  39.     | choice installed on your machine before you begin development.
  40.     |
  41.     */
  42.  
  43.     'connections' => [
  44.  
  45.         'sqlite' => [
  46.             'driver' => 'sqlite',
  47.             'database' => env('DB_DATABASE', database_path('database.sqlite')),
  48.             'prefix' => '',
  49.         ],
  50.  
  51.         'mysql' => [
  52.             'driver' => 'mysql',
  53.             'host' => env('DB_HOST', $server),
  54.             'port' => env('DB_PORT', $port),
  55.             'database' => env('DB_DATABASE', $db),
  56.             'username' => env('DB_USERNAME', $username),
  57.             'password' => env('DB_PASSWORD', $password),
  58.             'unix_socket' => env('DB_SOCKET', ''),
  59.             'charset' => 'utf8mb4',
  60.             'collation' => 'utf8mb4_unicode_ci',
  61.             'prefix' => '',
  62.             'strict' => true,
  63.             'engine' => null,
  64.         ],
  65.  
  66.         'pgsql' => [
  67.             'driver' => 'pgsql',
  68.             'host' => env('DB_HOST', $server),
  69.             'port' => env('DB_PORT', $port),
  70.             'database' => env('DB_DATABASE', $db),
  71.             'username' => env('DB_USERNAME', $username),
  72.             'password' => env('DB_PASSWORD', $password),
  73.             'charset' => 'utf8',
  74.             'prefix' => '',
  75.             'schema' => 'public',
  76.             'sslmode' => 'prefer',
  77.         ],
  78.  
  79.         'sqlsrv' => [
  80.             'driver' => 'sqlsrv',
  81.             'host' => env('DB_HOST', 'localhost'),
  82.             'port' => env('DB_PORT', '1433'),
  83.             'database' => env('DB_DATABASE', 'forge'),
  84.             'username' => env('DB_USERNAME', 'forge'),
  85.             'password' => env('DB_PASSWORD', ''),
  86.             'charset' => 'utf8',
  87.             'prefix' => '',
  88.         ],
  89.  
  90.     ],
  91.  
  92.     /*
  93.     |--------------------------------------------------------------------------
  94.     | Migration Repository Table
  95.     |--------------------------------------------------------------------------
  96.     |
  97.     | This table keeps track of all the migrations that have already run for
  98.     | your application. Using this information, we can determine which of
  99.     | the migrations on disk haven't actually been run in the database.
  100.     |
  101.     */
  102.  
  103.     'migrations' => 'migrations',
  104.  
  105.     /*
  106.     |--------------------------------------------------------------------------
  107.     | Redis Databases
  108.     |--------------------------------------------------------------------------
  109.     |
  110.     | Redis is an open source, fast, and advanced key-value store that also
  111.     | provides a richer set of commands than a typical key-value systems
  112.     | such as APC or Memcached. Laravel makes it easy to dig right in.
  113.     |
  114.     */
  115.  
  116.     'redis' => [
  117.  
  118.         'client' => 'predis',
  119.  
  120.         'default' => [
  121.             'host' => env('REDIS_HOST', '127.0.0.1'),
  122.             'password' => env('REDIS_PASSWORD', null),
  123.             'port' => env('REDIS_PORT', 6379),
  124.             'database' => 0,
  125.         ],
  126.  
  127.     ],
  128.  
  129. ];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement