database.php 6.8 KB

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