database.php 6.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  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 database operations. This is
  11. | the connection which will be utilized unless another connection
  12. | is explicitly specified when you execute a query / statement.
  13. |
  14. */
  15. 'default' => env('DB_CONNECTION', 'sqlite'),
  16. /*
  17. |--------------------------------------------------------------------------
  18. | Database Connections
  19. |--------------------------------------------------------------------------
  20. |
  21. | Below are all of the database connections defined for your application.
  22. | An example configuration is provided for each database system which
  23. | is supported by Laravel. You're free to add / remove connections.
  24. |
  25. */
  26. 'connections' => [
  27. 'sqlite' => [
  28. 'driver' => 'sqlite',
  29. 'url' => env('DB_URL'),
  30. 'database' => env('DB_DATABASE', database_path('database.sqlite')),
  31. 'prefix' => '',
  32. 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
  33. 'busy_timeout' => null,
  34. 'journal_mode' => null,
  35. 'synchronous' => null,
  36. 'transaction_mode' => 'DEFERRED',
  37. ],
  38. 'mysql' => [
  39. 'driver' => 'mysql',
  40. 'url' => env('DB_URL'),
  41. 'host' => env('DB_HOST', '127.0.0.1'),
  42. 'port' => env('DB_PORT', '3306'),
  43. 'database' => env('DB_DATABASE', 'laravel'),
  44. 'username' => env('DB_USERNAME', 'root'),
  45. 'password' => env('DB_PASSWORD', ''),
  46. 'unix_socket' => env('DB_SOCKET', ''),
  47. 'charset' => env('DB_CHARSET', 'utf8mb4'),
  48. 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
  49. 'prefix' => '',
  50. 'prefix_indexes' => true,
  51. 'strict' => true,
  52. 'engine' => null,
  53. 'options' => extension_loaded('pdo_mysql') ? array_filter([
  54. PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
  55. ]) : [],
  56. ],
  57. 'mariadb' => [
  58. 'driver' => 'mariadb',
  59. 'url' => env('DB_URL'),
  60. 'host' => env('DB_HOST', '127.0.0.1'),
  61. 'port' => env('DB_PORT', '3306'),
  62. 'database' => env('DB_DATABASE', 'laravel'),
  63. 'username' => env('DB_USERNAME', 'root'),
  64. 'password' => env('DB_PASSWORD', ''),
  65. 'unix_socket' => env('DB_SOCKET', ''),
  66. 'charset' => env('DB_CHARSET', 'utf8mb4'),
  67. 'collation' => env('DB_COLLATION', 'utf8mb4_unicode_ci'),
  68. 'prefix' => '',
  69. 'prefix_indexes' => true,
  70. 'strict' => true,
  71. 'engine' => null,
  72. 'options' => extension_loaded('pdo_mysql') ? array_filter([
  73. PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
  74. ]) : [],
  75. ],
  76. 'pgsql' => [
  77. 'driver' => 'pgsql',
  78. 'url' => env('DB_URL'),
  79. 'host' => env('DB_HOST', '127.0.0.1'),
  80. 'port' => env('DB_PORT', '5432'),
  81. 'database' => env('DB_DATABASE', 'laravel'),
  82. 'username' => env('DB_USERNAME', 'root'),
  83. 'password' => env('DB_PASSWORD', ''),
  84. 'charset' => env('DB_CHARSET', 'utf8'),
  85. 'prefix' => '',
  86. 'prefix_indexes' => true,
  87. 'search_path' => 'public',
  88. 'sslmode' => 'prefer',
  89. ],
  90. 'sqlsrv' => [
  91. 'driver' => 'sqlsrv',
  92. 'url' => env('DB_URL'),
  93. 'host' => env('DB_HOST', 'localhost'),
  94. 'port' => env('DB_PORT', '1433'),
  95. 'database' => env('DB_DATABASE', 'laravel'),
  96. 'username' => env('DB_USERNAME', 'root'),
  97. 'password' => env('DB_PASSWORD', ''),
  98. 'charset' => env('DB_CHARSET', 'utf8'),
  99. 'prefix' => '',
  100. 'prefix_indexes' => true,
  101. // 'encrypt' => env('DB_ENCRYPT', 'yes'),
  102. // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'),
  103. ],
  104. ],
  105. /*
  106. |--------------------------------------------------------------------------
  107. | Migration Repository Table
  108. |--------------------------------------------------------------------------
  109. |
  110. | This table keeps track of all the migrations that have already run for
  111. | your application. Using this information, we can determine which of
  112. | the migrations on disk haven't actually been run on the database.
  113. |
  114. */
  115. 'migrations' => [
  116. 'table' => 'migrations',
  117. 'update_date_on_publish' => true,
  118. ],
  119. /*
  120. |--------------------------------------------------------------------------
  121. | Redis Databases
  122. |--------------------------------------------------------------------------
  123. |
  124. | Redis is an open source, fast, and advanced key-value store that also
  125. | provides a richer body of commands than a typical key-value system
  126. | such as Memcached. You may define your connection settings here.
  127. |
  128. */
  129. 'redis' => [
  130. 'client' => env('REDIS_CLIENT', 'phpredis'),
  131. 'options' => [
  132. 'cluster' => env('REDIS_CLUSTER', 'redis'),
  133. 'prefix' => env('REDIS_PREFIX', Str::slug((string) env('APP_NAME', 'laravel')).'-database-'),
  134. 'persistent' => env('REDIS_PERSISTENT', false),
  135. ],
  136. 'default' => [
  137. 'url' => env('REDIS_URL'),
  138. 'host' => env('REDIS_HOST', '127.0.0.1'),
  139. 'username' => env('REDIS_USERNAME'),
  140. 'password' => env('REDIS_PASSWORD'),
  141. 'port' => env('REDIS_PORT', '6379'),
  142. 'database' => env('REDIS_DB', '0'),
  143. 'max_retries' => env('REDIS_MAX_RETRIES', 3),
  144. 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
  145. 'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
  146. 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
  147. ],
  148. 'cache' => [
  149. 'url' => env('REDIS_URL'),
  150. 'host' => env('REDIS_HOST', '127.0.0.1'),
  151. 'username' => env('REDIS_USERNAME'),
  152. 'password' => env('REDIS_PASSWORD'),
  153. 'port' => env('REDIS_PORT', '6379'),
  154. 'database' => env('REDIS_CACHE_DB', '1'),
  155. 'max_retries' => env('REDIS_MAX_RETRIES', 3),
  156. 'backoff_algorithm' => env('REDIS_BACKOFF_ALGORITHM', 'decorrelated_jitter'),
  157. 'backoff_base' => env('REDIS_BACKOFF_BASE', 100),
  158. 'backoff_cap' => env('REDIS_BACKOFF_CAP', 1000),
  159. ],
  160. ],
  161. ];