database.php 6.4 KB

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