database.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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 all database work. Of course
  11. | you may use many connections at once using the Database library.
  12. |
  13. */
  14. 'default' => env('DB_CONNECTION', 'mysql'),
  15. /*
  16. |--------------------------------------------------------------------------
  17. | Database Connections
  18. |--------------------------------------------------------------------------
  19. |
  20. | Here are each of the database connections setup for your application.
  21. | Of course, examples of configuring each database platform that is
  22. | supported by Laravel is shown below to make development simple.
  23. |
  24. |
  25. | All database work in Laravel is done through the PHP PDO facilities
  26. | so make sure you have the driver for your particular database of
  27. | choice installed on your machine before you begin development.
  28. |
  29. */
  30. 'connections' => [
  31. 'sqlite' => [
  32. 'driver' => 'sqlite',
  33. 'database' => env('DB_DATABASE', database_path('database.sqlite')),
  34. 'prefix' => '',
  35. 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
  36. ],
  37. 'mysql' => [
  38. 'driver' => 'mysql',
  39. 'host' => env('DB_HOST', '127.0.0.1'),
  40. 'port' => env('DB_PORT', '3306'),
  41. 'database' => env('DB_DATABASE', 'forge'),
  42. 'username' => env('DB_USERNAME', 'forge'),
  43. 'password' => env('DB_PASSWORD', ''),
  44. 'unix_socket' => env('DB_SOCKET', ''),
  45. 'charset' => 'utf8mb4',
  46. 'collation' => 'utf8mb4_unicode_ci',
  47. 'prefix' => '',
  48. 'prefix_indexes' => true,
  49. 'strict' => true,
  50. 'engine' => null,
  51. 'options' => extension_loaded('pdo_mysql') ? array_filter([
  52. PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
  53. ]) : [],
  54. ],
  55. 'pgsql' => [
  56. 'driver' => 'pgsql',
  57. 'host' => env('DB_HOST', '127.0.0.1'),
  58. 'port' => env('DB_PORT', '5432'),
  59. 'database' => env('DB_DATABASE', 'forge'),
  60. 'username' => env('DB_USERNAME', 'forge'),
  61. 'password' => env('DB_PASSWORD', ''),
  62. 'charset' => 'utf8',
  63. 'prefix' => '',
  64. 'prefix_indexes' => true,
  65. 'schema' => 'public',
  66. 'sslmode' => 'prefer',
  67. ],
  68. 'sqlsrv' => [
  69. 'driver' => 'sqlsrv',
  70. 'host' => env('DB_HOST', 'localhost'),
  71. 'port' => env('DB_PORT', '1433'),
  72. 'database' => env('DB_DATABASE', 'forge'),
  73. 'username' => env('DB_USERNAME', 'forge'),
  74. 'password' => env('DB_PASSWORD', ''),
  75. 'charset' => 'utf8',
  76. 'prefix' => '',
  77. 'prefix_indexes' => true,
  78. ],
  79. ],
  80. /*
  81. |--------------------------------------------------------------------------
  82. | Migration Repository Table
  83. |--------------------------------------------------------------------------
  84. |
  85. | This table keeps track of all the migrations that have already run for
  86. | your application. Using this information, we can determine which of
  87. | the migrations on disk haven't actually been run in the database.
  88. |
  89. */
  90. 'migrations' => 'migrations',
  91. /*
  92. |--------------------------------------------------------------------------
  93. | Redis Databases
  94. |--------------------------------------------------------------------------
  95. |
  96. | Redis is an open source, fast, and advanced key-value store that also
  97. | provides a richer body of commands than a typical key-value system
  98. | such as APC or Memcached. Laravel makes it easy to dig right in.
  99. |
  100. */
  101. 'redis' => [
  102. 'client' => env('REDIS_CLIENT', 'predis'),
  103. 'options' => [
  104. 'cluster' => env('REDIS_CLUSTER', 'predis'),
  105. 'prefix' => Str::slug(env('APP_NAME', 'laravel'), '_').'_database',
  106. ],
  107. 'default' => [
  108. 'host' => env('REDIS_HOST', '127.0.0.1'),
  109. 'password' => env('REDIS_PASSWORD', null),
  110. 'port' => env('REDIS_PORT', 6379),
  111. 'database' => env('REDIS_DB', 0),
  112. ],
  113. 'cache' => [
  114. 'host' => env('REDIS_HOST', '127.0.0.1'),
  115. 'password' => env('REDIS_PASSWORD', null),
  116. 'port' => env('REDIS_PORT', 6379),
  117. 'database' => env('REDIS_CACHE_DB', 1),
  118. ],
  119. ],
  120. ];