database.php
1 <?php 2 3 use Illuminate\Support\Str; 4 5 return [ 6 7 /* 8 |-------------------------------------------------------------------------- 9 | Default Database Connection Name 10 |-------------------------------------------------------------------------- 11 | 12 | Here you may specify which of the database connections below you wish 13 | to use as your default connection for all database work. Of course 14 | you may use many connections at once using the Database library. 15 | 16 */ 17 18 'default' => env('DB_CONNECTION', 'mysql'), 19 20 /* 21 |-------------------------------------------------------------------------- 22 | Database Connections 23 |-------------------------------------------------------------------------- 24 | 25 | Here are each of the database connections setup for your application. 26 | Of course, examples of configuring each database platform that is 27 | supported by Laravel is shown below to make development simple. 28 | 29 | 30 | All database work in Laravel is done through the PHP PDO facilities 31 | so make sure you have the driver for your particular database of 32 | choice installed on your machine before you begin development. 33 | 34 */ 35 36 'connections' => [ 37 38 'sqlite' => [ 39 'driver' => 'sqlite', 40 'url' => env('DATABASE_URL'), 41 'database' => env('DB_DATABASE', database_path('database.sqlite')), 42 'prefix' => '', 43 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true), 44 ], 45 46 'mysql' => [ 47 'driver' => 'mysql', 48 'url' => env('DATABASE_URL'), 49 'host' => env('DB_HOST', '127.0.0.1'), 50 'port' => env('DB_PORT', '3306'), 51 'database' => env('DB_DATABASE', 'forge'), 52 'username' => env('DB_USERNAME', 'forge'), 53 'password' => env('DB_PASSWORD', ''), 54 'unix_socket' => env('DB_SOCKET', ''), 55 'charset' => 'utf8mb4', 56 'collation' => 'utf8mb4_unicode_ci', 57 'prefix' => '', 58 'prefix_indexes' => true, 59 'strict' => true, 60 'engine' => null, 61 'options' => extension_loaded('pdo_mysql') ? array_filter([ 62 PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'), 63 ]) : [], 64 ], 65 'oracle' => [ 66 'driver' => 'oracle', 67 'tns' => env('ORACLE_DB_TNS', ''), 68 'host' => env('ORACLE_DB_HOST', ''), 69 'port' => env('ORACLE_DB_PORT', '1521'), 70 'database' => env('ORACLE_DB_DATABASE', ''), 71 'service_name' => env('ORACLE_DB_SERVICE_NAME', 'sid_alias'), 72 'username' => env('ORACLE_DB_USERNAME', ''), 73 'password' => env('ORACLE_DB_PASSWORD', ''), 74 'charset' => env('ORACLE_DB_CHARSET', ''), 75 'prefix' => env('ORACLE_DB_PREFIX', ''), 76 //'prefix_schema' => env('ORACLE_DB_SCHEMA_PREFIX', ''), 77 //'edition' => env('ORACLE_DB_EDITION', 'ora$base'), 78 //'server_version' => env('ORACLE_DB_SERVER_VERSION', '18c'), 79 //'load_balance' => env('ORACLE_DB_LOAD_BALANCE', 'yes'), 80 //'dynamic' => [], 81 ], 82 'pgsql' => [ 83 'driver' => 'pgsql', 84 'url' => env('DATABASE_URL'), 85 'host' => env('DB_HOST', '127.0.0.1'), 86 'port' => env('DB_PORT', '5432'), 87 'database' => env('DB_DATABASE', 'forge'), 88 'username' => env('DB_USERNAME', 'forge'), 89 'password' => env('DB_PASSWORD', ''), 90 'charset' => 'utf8', 91 'prefix' => '', 92 'prefix_indexes' => true, 93 'search_path' => 'public', 94 'sslmode' => 'prefer', 95 ], 96 97 'sqlsrv' => [ 98 'driver' => 'sqlsrv', 99 'url' => env('DATABASE_URL'), 100 'host' => env('DB_HOST', 'localhost'), 101 'port' => env('DB_PORT', '1433'), 102 'database' => env('DB_DATABASE', 'forge'), 103 'username' => env('DB_USERNAME', 'forge'), 104 'password' => env('DB_PASSWORD', ''), 105 'charset' => 'utf8', 106 'prefix' => '', 107 'prefix_indexes' => true, 108 // 'encrypt' => env('DB_ENCRYPT', 'yes'), 109 // 'trust_server_certificate' => env('DB_TRUST_SERVER_CERTIFICATE', 'false'), 110 ], 111 112 ], 113 114 /* 115 |-------------------------------------------------------------------------- 116 | Migration Repository Table 117 |-------------------------------------------------------------------------- 118 | 119 | This table keeps track of all the migrations that have already run for 120 | your application. Using this information, we can determine which of 121 | the migrations on disk haven't actually been run in the database. 122 | 123 */ 124 125 'migrations' => 'migrations', 126 127 /* 128 |-------------------------------------------------------------------------- 129 | Redis Databases 130 |-------------------------------------------------------------------------- 131 | 132 | Redis is an open source, fast, and advanced key-value store that also 133 | provides a richer body of commands than a typical key-value system 134 | such as APC or Memcached. Laravel makes it easy to dig right in. 135 | 136 */ 137 138 'redis' => [ 139 140 'client' => env('REDIS_CLIENT', 'phpredis'), 141 142 'options' => [ 143 'cluster' => env('REDIS_CLUSTER', 'redis'), 144 'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), 145 ], 146 147 'default' => [ 148 'url' => env('REDIS_URL'), 149 'host' => env('REDIS_HOST', '127.0.0.1'), 150 'username' => env('REDIS_USERNAME'), 151 'password' => env('REDIS_PASSWORD'), 152 'port' => env('REDIS_PORT', '6379'), 153 'database' => env('REDIS_DB', '0'), 154 ], 155 156 'cache' => [ 157 'url' => env('REDIS_URL'), 158 'host' => env('REDIS_HOST', '127.0.0.1'), 159 'username' => env('REDIS_USERNAME'), 160 'password' => env('REDIS_PASSWORD'), 161 'port' => env('REDIS_PORT', '6379'), 162 'database' => env('REDIS_CACHE_DB', '1'), 163 ], 164 165 ], 166 167 ];