database.php 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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' => env('DB_STRICT', false),
  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. 'pgsql' => [
  67. 'driver' => 'pgsql',
  68. 'url' => env('DATABASE_URL'),
  69. 'host' => env('DB_HOST', '127.0.0.1'),
  70. 'port' => env('DB_PORT', '5432'),
  71. 'database' => env('DB_DATABASE', 'forge'),
  72. 'username' => env('DB_USERNAME', 'forge'),
  73. 'password' => env('DB_PASSWORD', ''),
  74. 'charset' => 'utf8',
  75. 'prefix' => env('DB_PREFIX', ''),
  76. 'prefix_indexes' => true,
  77. 'schema' => 'public',
  78. 'sslmode' => 'prefer',
  79. ],
  80. 'sqlsrv' => [
  81. 'driver' => 'sqlsrv',
  82. 'url' => env('DATABASE_URL'),
  83. 'host' => env('DB_HOST', 'localhost'),
  84. 'port' => env('DB_PORT', '1433'),
  85. 'database' => env('DB_DATABASE', 'forge'),
  86. 'username' => env('DB_USERNAME', 'forge'),
  87. 'password' => env('DB_PASSWORD', ''),
  88. 'charset' => 'utf8',
  89. 'prefix' => env('DB_PREFIX', ''),
  90. 'prefix_indexes' => true,
  91. ],
  92. ],
  93. /*
  94. |--------------------------------------------------------------------------
  95. | Migration Repository Table
  96. |--------------------------------------------------------------------------
  97. |
  98. | This table keeps track of all the migrations that have already run for
  99. | your application. Using this information, we can determine which of
  100. | the migrations on disk haven't actually been run in the database.
  101. |
  102. */
  103. 'migrations' => 'migrations',
  104. /*
  105. |--------------------------------------------------------------------------
  106. | Redis Databases
  107. |--------------------------------------------------------------------------
  108. |
  109. | Redis is an open source, fast, and advanced key-value store that also
  110. | provides a richer body of commands than a typical key-value system
  111. | such as APC or Memcached. Laravel makes it easy to dig right in.
  112. |
  113. */
  114. 'redis' => [
  115. 'client' => env('REDIS_CLIENT', 'phpredis'),
  116. 'options' => [
  117. 'cluster' => env('REDIS_CLUSTER', 'redis'),
  118. 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
  119. ],
  120. 'default' => [
  121. 'url' => env('REDIS_URL'),
  122. 'host' => env('REDIS_HOST', '127.0.0.1'),
  123. 'password' => env('REDIS_PASSWORD', null),
  124. 'port' => env('REDIS_PORT', '6379'),
  125. 'database' => env('REDIS_DB', '0'),
  126. ],
  127. 'cache' => [
  128. 'url' => env('REDIS_URL'),
  129. 'host' => env('REDIS_HOST', '127.0.0.1'),
  130. 'password' => env('REDIS_PASSWORD', null),
  131. 'port' => env('REDIS_PORT', '6379'),
  132. 'database' => env('REDIS_CACHE_DB', '1'),
  133. ],
  134. ],
  135. ];