database.php 5.9 KB

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