database.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?php
  2. return [
  3. /*
  4. |--------------------------------------------------------------------------
  5. | PDO Fetch Style
  6. |--------------------------------------------------------------------------
  7. |
  8. | By default, database results will be returned as instances of the PHP
  9. | stdClass object; however, you may desire to retrieve records in an
  10. | array format for simplicity. Here you can tweak the fetch style.
  11. |
  12. */
  13. 'fetch' => PDO::FETCH_CLASS,
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Default Database Connection Name
  17. |--------------------------------------------------------------------------
  18. |
  19. | Here you may specify which of the database connections below you wish
  20. | to use as your default connection for all database work. Of course
  21. | you may use many connections at once using the Database library.
  22. |
  23. */
  24. 'default' => env('DB_CONNECTION', 'mysql'),
  25. /*
  26. |--------------------------------------------------------------------------
  27. | 是否开启事务
  28. |--------------------------------------------------------------------------
  29. | 是否主动开启,配置为是,在put、delete、post请求时会主动开启事务,开发人员不必在代码里
  30. | 添加开启事务代码,开始事务、提交事务、回滚事务会再中间件自动处理,配置为否时,所有的请求
  31. | 都不开启事务
  32. |
  33. */
  34. 'transaction' => env('DB_TRANSACTION', false),
  35. /*
  36. |--------------------------------------------------------------------------
  37. | Database Connections
  38. |--------------------------------------------------------------------------
  39. |
  40. | Here are each of the database connections setup for your application.
  41. | Of course, examples of configuring each database platform that is
  42. | supported by Laravel is shown below to make development simple.
  43. |
  44. |
  45. | All database work in Laravel is done through the PHP PDO facilities
  46. | so make sure you have the driver for your particular database of
  47. | choice installed on your machine before you begin development.
  48. |
  49. */
  50. 'connections' => [
  51. 'testing' => [
  52. 'driver' => 'sqlite',
  53. 'database' => ':memory:',
  54. ],
  55. 'mysql' => [
  56. 'driver' => 'mysql',
  57. 'host' => env('DB_HOST', '147.114.90.54'),
  58. 'port' => env('DB_PORT', 3306),
  59. 'database' => env('DB_DATABASE', 'matchexpo_new'),
  60. 'username' => env('DB_USERNAME', 'matchexpo'),
  61. 'password' => env('DB_PASSWORD', 'matchexpo0823!@'),
  62. 'charset' => env('DB_CHARSET', 'utf8mb4'),
  63. 'collation' => env('DB_COLLATION', 'utf8mb4_general_ci'),
  64. 'prefix' => env('DB_PREFIX', ''),
  65. 'timezone' => env('DB_TIMEZONE', '+08:00'),
  66. 'strict' => env('DB_STRICT_MODE', false),
  67. // 'options' => [
  68. // MYSQLI_OPT_INT_AND_FLOAT_NATIVE => true,
  69. // PDO::ATTR_PERSISTENT => true,
  70. // ]
  71. // MYSQLI_OPT_INT_AND_FLOAT_NATIVE=>true
  72. ],
  73. 'mongodb' => [
  74. 'driver' => 'mongodb',
  75. 'host' => env('MONGO_HOST', 'localhost'),
  76. 'port' => env('MONGO_PORT', 27017),
  77. 'database' => env('MONGO_DATABASE'),
  78. 'username' => env('MONGO_USERNAME'),
  79. 'password' => env('MONGO_PASSWORD'),
  80. 'options' => [
  81. 'database' => 'admin' // sets the authentication database required by mongo 3
  82. ]
  83. ],
  84. ],
  85. /*
  86. |--------------------------------------------------------------------------
  87. | Migration Repository Table
  88. |--------------------------------------------------------------------------
  89. |
  90. | This table keeps track of all the migrations that have already run for
  91. | your application. Using this information, we can determine which of
  92. | the migrations on disk haven't actually been run in the database.
  93. |
  94. */
  95. 'migrations' => 'migrations',
  96. /*
  97. |--------------------------------------------------------------------------
  98. | Redis Databases
  99. |--------------------------------------------------------------------------
  100. |
  101. | Redis is an open source, fast, and advanced key-value store that also
  102. | provides a richer set of commands than a typical key-value systems
  103. | such as APC or Memcached. Laravel makes it easy to dig right in.
  104. |
  105. */
  106. 'redis' => [
  107. 'cluster' => env('REDIS_CLUSTER', false),
  108. 'default' => [
  109. 'host' => env('REDIS_HOST', '127.0.0.1'),
  110. 'port' => env('REDIS_PORT', 6379),
  111. 'database' => env('REDIS_DATABASE', 0),
  112. 'password' => env('REDIS_PASSWORD', null),
  113. 'read_write_timeout' => -1,
  114. ],
  115. ],
  116. 'max_idle_time' => env('DB_MAX_IDLE_TIME', 30),
  117. ];