database.php 6.8 KB

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