database.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. use Illuminate\Support\Str;
  3. return [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Default Database Connection Name
  7. |--------------------------------------------------------------------------
  8. |
  9. | Here you may specify which of the database connections below you wish
  10. | to use as your default connection for all database work. Of course
  11. | you may use many connections at once using the Database library.
  12. |
  13. */
  14. 'default' => env('DB_CONNECTION', 'mysql'),
  15. /*
  16. |--------------------------------------------------------------------------
  17. | Database Connections
  18. |--------------------------------------------------------------------------
  19. |
  20. | Here are each of the database connections setup for your application.
  21. | Of course, examples of configuring each database platform that is
  22. | supported by Laravel is shown below to make development simple.
  23. |
  24. |
  25. | All database work in Laravel is done through the PHP PDO facilities
  26. | so make sure you have the driver for your particular database of
  27. | choice installed on your machine before you begin development.
  28. |
  29. */
  30. 'connections' => [
  31. 'sqlite' => [
  32. 'driver' => 'sqlite',
  33. 'url' => env('DATABASE_URL'),
  34. 'database' => env('DB_DATABASE', database_path('database.sqlite')),
  35. 'prefix' => '',
  36. 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
  37. ],
  38. 'mysql' => [
  39. 'driver' => 'mysql',
  40. 'url' => env('DATABASE_URL'),
  41. 'host' => env('DB_HOST', '127.0.0.1'),
  42. 'port' => env('DB_PORT', '3306'),
  43. 'database' => env('DB_DATABASE', 'forge'),
  44. 'username' => env('DB_USERNAME', 'forge'),
  45. 'password' => env('DB_PASSWORD', ''),
  46. 'unix_socket' => env('DB_SOCKET', ''),
  47. 'charset' => 'utf8mb4',
  48. 'collation' => 'utf8mb4_unicode_ci',
  49. // 'prefix' => '',
  50. // 'prefix_indexes' => true,
  51. // 'strict' => true,
  52. // 'engine' => null,
  53. // 'timezone' => env('DB_TIMEZONE', '+08:00'),
  54. // 'options' => extension_loaded('pdo_mysql') ? array_filter([
  55. // PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
  56. // ]) : [],
  57. ],
  58. 'mysql_dwbs' => [
  59. 'driver' => 'mysql',
  60. 'url' => env('DATABASE_URL_DWBS'),
  61. 'host' => env('DB_HOST_DWBS', '127.0.0.1'),
  62. 'port' => env('DB_PORT_DWBS', '3306'),
  63. 'database' => env('DB_DATABASE_DWBS', 'forge'),
  64. 'username' => env('DB_USERNAME_DWBS', 'forge'),
  65. 'password' => env('DB_PASSWORD_DWBS', ''),
  66. 'unix_socket' => env('DB_SOCKET_DWBS', ''),
  67. 'charset' => 'utf8mb4',
  68. 'collation' => 'utf8mb4_unicode_ci',
  69. // 'prefix' => '',
  70. // 'prefix_indexes' => true,
  71. // 'strict' => true,
  72. // 'engine' => null,
  73. ],
  74. 'mysql_z' => [
  75. 'driver' => 'mysql',
  76. 'host' => env('DB_HOST_Z', '127.0.0.1'),
  77. 'port' => env('DB_PORT_Z', 3306),
  78. 'database' => env('DB_DATABASE_Z', 'forge'),
  79. 'username' => env('DB_USERNAME_Z', 'forge'),
  80. 'password' => env('DB_PASSWORD_Z', ''),
  81. 'unix_socket' => env('DB_SOCKET_Z', ''),
  82. 'charset' => env('DB_CHARSET_Z', 'utf8mb4'),
  83. 'collation' => env('DB_COLLATION_Z', 'utf8mb4_unicode_ci'),
  84. 'prefix' => env('DB_PREFIX_Z', ''),
  85. 'strict' => env('DB_STRICT_MODE_Z', true),
  86. 'engine' => env('DB_ENGINE_Z', null),
  87. ],
  88. 'pgsql' => [
  89. 'driver' => 'pgsql',
  90. 'url' => env('DATABASE_URL'),
  91. 'host' => env('DB_HOST', '127.0.0.1'),
  92. 'port' => env('DB_PORT', '5432'),
  93. 'database' => env('DB_DATABASE', 'forge'),
  94. 'username' => env('DB_USERNAME', 'forge'),
  95. 'password' => env('DB_PASSWORD', ''),
  96. 'charset' => 'utf8',
  97. 'prefix' => '',
  98. 'prefix_indexes' => true,
  99. 'schema' => 'public',
  100. 'sslmode' => 'prefer',
  101. ],
  102. 'sqlsrv' => [
  103. 'driver' => 'sqlsrv',
  104. 'url' => env('DATABASE_URL'),
  105. 'host' => env('DB_HOST', 'localhost'),
  106. 'port' => env('DB_PORT', '1433'),
  107. 'database' => env('DB_DATABASE', 'forge'),
  108. 'username' => env('DB_USERNAME', 'forge'),
  109. 'password' => env('DB_PASSWORD', ''),
  110. 'charset' => 'utf8',
  111. 'prefix' => '',
  112. 'prefix_indexes' => true,
  113. ],
  114. ],
  115. /*
  116. |--------------------------------------------------------------------------
  117. | Migration Repository Table
  118. |--------------------------------------------------------------------------
  119. |
  120. | This table keeps track of all the migrations that have already run for
  121. | your application. Using this information, we can determine which of
  122. | the migrations on disk haven't actually been run in the database.
  123. |
  124. */
  125. 'migrations' => 'migrations',
  126. /*
  127. |--------------------------------------------------------------------------
  128. | Redis Databases
  129. |--------------------------------------------------------------------------
  130. |
  131. | Redis is an open source, fast, and advanced key-value store that also
  132. | provides a richer body of commands than a typical key-value system
  133. | such as APC or Memcached. Laravel makes it easy to dig right in.
  134. |
  135. */
  136. 'redis' => [
  137. 'client' => env('REDIS_CLIENT', 'phpredis'),
  138. 'options' => [
  139. 'cluster' => env('REDIS_CLUSTER', 'redis'),
  140. 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
  141. ],
  142. 'default' => [
  143. 'url' => env('REDIS_URL'),
  144. 'host' => env('REDIS_HOST', '127.0.0.1'),
  145. 'password' => env('REDIS_PASSWORD', null),
  146. 'port' => env('REDIS_PORT', 6379),
  147. 'database' => env('REDIS_DB', 0),
  148. ],
  149. 'cache' => [
  150. 'url' => env('REDIS_URL'),
  151. 'host' => env('REDIS_HOST', '127.0.0.1'),
  152. 'password' => env('REDIS_PASSWORD', null),
  153. 'port' => env('REDIS_PORT', 6379),
  154. 'database' => env('REDIS_CACHE_DB', 1),
  155. ],
  156. ],
  157. ];