質問編集履歴
1
コード
test
CHANGED
File without changes
|
test
CHANGED
@@ -60,6 +60,390 @@
|
|
60
60
|
|
61
61
|
|
62
62
|
|
63
|
+
``` php
|
64
|
+
|
65
|
+
<?php
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
use Illuminate\Support\Str;
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
$DB_CONNECTION = env('APP_ENV') === 'production' ? 'production' : 'development';
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
return [
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
/*
|
82
|
+
|
83
|
+
|--------------------------------------------------------------------------
|
84
|
+
|
85
|
+
| Default Database Connection Name
|
86
|
+
|
87
|
+
|--------------------------------------------------------------------------
|
88
|
+
|
89
|
+
|
|
90
|
+
|
91
|
+
| Here you may specify which of the database connections below you wish
|
92
|
+
|
93
|
+
| to use as your default connection for all database work. Of course
|
94
|
+
|
95
|
+
| you may use many connections at once using the Database library.
|
96
|
+
|
97
|
+
|
|
98
|
+
|
99
|
+
*/
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
'default' => $DB_CONNECTION,
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
/*
|
108
|
+
|
109
|
+
|--------------------------------------------------------------------------
|
110
|
+
|
111
|
+
| Database Connections
|
112
|
+
|
113
|
+
|--------------------------------------------------------------------------
|
114
|
+
|
115
|
+
|
|
116
|
+
|
117
|
+
| Here are each of the database connections setup for your application.
|
118
|
+
|
119
|
+
| Of course, examples of configuring each database platform that is
|
120
|
+
|
121
|
+
| supported by Laravel is shown below to make development simple.
|
122
|
+
|
123
|
+
|
|
124
|
+
|
125
|
+
|
|
126
|
+
|
127
|
+
| All database work in Laravel is done through the PHP PDO facilities
|
128
|
+
|
129
|
+
| so make sure you have the driver for your particular database of
|
130
|
+
|
131
|
+
| choice installed on your machine before you begin development.
|
132
|
+
|
133
|
+
|
|
134
|
+
|
135
|
+
*/
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
'connections' => [
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
'development' => [
|
144
|
+
|
145
|
+
'driver' => 'mysql',
|
146
|
+
|
147
|
+
// 'url' => env('DATABASE_URL_DEV'),
|
148
|
+
|
149
|
+
'host' => env('DB_HOST_DEV', '127.0.0.1'),
|
150
|
+
|
151
|
+
'port' => env('DB_PORT_DEV', '3306'),
|
152
|
+
|
153
|
+
'database' => env('DB_DATABASE_DEV', 'forge'),
|
154
|
+
|
155
|
+
'username' => env('DB_USERNAME_DEV', 'forge'),
|
156
|
+
|
157
|
+
'password' => env('DB_PASSWORD_DEV', ''),
|
158
|
+
|
159
|
+
'unix_socket' => env('DB_SOCKET_DEV', ''),
|
160
|
+
|
161
|
+
'charset' => 'utf8mb4',
|
162
|
+
|
163
|
+
'collation' => 'utf8mb4_unicode_ci',
|
164
|
+
|
165
|
+
'prefix' => '',
|
166
|
+
|
167
|
+
'prefix_indexes' => true,
|
168
|
+
|
169
|
+
'strict' => true,
|
170
|
+
|
171
|
+
'engine' => null,
|
172
|
+
|
173
|
+
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
174
|
+
|
175
|
+
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
176
|
+
|
177
|
+
]) : [],
|
178
|
+
|
179
|
+
],
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
'production' => [
|
184
|
+
|
185
|
+
'driver' => 'mysql',
|
186
|
+
|
187
|
+
// 'url' => env('DATABASE_URL'),
|
188
|
+
|
189
|
+
'host' => env('DB_HOST', '127.0.0.1'),
|
190
|
+
|
191
|
+
'port' => env('DB_PORT', '3306'),
|
192
|
+
|
193
|
+
'database' => env('DB_DATABASE', 'forge'),
|
194
|
+
|
195
|
+
'username' => env('DB_USERNAME', 'forge'),
|
196
|
+
|
197
|
+
'password' => env('DB_PASSWORD', ''),
|
198
|
+
|
199
|
+
'unix_socket' => env('DB_SOCKET', ''),
|
200
|
+
|
201
|
+
'charset' => 'utf8mb4',
|
202
|
+
|
203
|
+
'collation' => 'utf8mb4_unicode_ci',
|
204
|
+
|
205
|
+
'prefix' => '',
|
206
|
+
|
207
|
+
'prefix_indexes' => true,
|
208
|
+
|
209
|
+
'strict' => true,
|
210
|
+
|
211
|
+
'engine' => null,
|
212
|
+
|
213
|
+
'options' => extension_loaded('pdo_mysql') ? array_filter([
|
214
|
+
|
215
|
+
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
216
|
+
|
217
|
+
]) : [],
|
218
|
+
|
219
|
+
],
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
// 'sqlite' => [
|
224
|
+
|
225
|
+
// 'driver' => 'sqlite',
|
226
|
+
|
227
|
+
// 'url' => env('DATABASE_URL'),
|
228
|
+
|
229
|
+
// 'database' => env('DB_DATABASE', database_path('database.sqlite')),
|
230
|
+
|
231
|
+
// 'prefix' => '',
|
232
|
+
|
233
|
+
// 'foreign_key_constraints' => env('DB_FOREIGN_KEYS', true),
|
234
|
+
|
235
|
+
// ],
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
// 'mysql' => [
|
240
|
+
|
241
|
+
// 'driver' => 'mysql',
|
242
|
+
|
243
|
+
// 'url' => env('DATABASE_URL'),
|
244
|
+
|
245
|
+
// 'host' => env('DB_HOST', '127.0.0.1'),
|
246
|
+
|
247
|
+
// 'port' => env('DB_PORT', '3306'),
|
248
|
+
|
249
|
+
// 'database' => env('DB_DATABASE', 'forge'),
|
250
|
+
|
251
|
+
// 'username' => env('DB_USERNAME', 'forge'),
|
252
|
+
|
253
|
+
// 'password' => env('DB_PASSWORD', ''),
|
254
|
+
|
255
|
+
// 'unix_socket' => env('DB_SOCKET', ''),
|
256
|
+
|
257
|
+
// 'charset' => 'utf8mb4',
|
258
|
+
|
259
|
+
// 'collation' => 'utf8mb4_unicode_ci',
|
260
|
+
|
261
|
+
// 'prefix' => '',
|
262
|
+
|
263
|
+
// 'prefix_indexes' => true,
|
264
|
+
|
265
|
+
// 'strict' => true,
|
266
|
+
|
267
|
+
// 'engine' => null,
|
268
|
+
|
269
|
+
// 'options' => extension_loaded('pdo_mysql') ? array_filter([
|
270
|
+
|
271
|
+
// PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
|
272
|
+
|
273
|
+
// ]) : [],
|
274
|
+
|
275
|
+
// ],
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
// 'pgsql' => [
|
280
|
+
|
281
|
+
// 'driver' => 'pgsql',
|
282
|
+
|
283
|
+
// 'url' => env('DATABASE_URL'),
|
284
|
+
|
285
|
+
// 'host' => env('DB_HOST', '127.0.0.1'),
|
286
|
+
|
287
|
+
// 'port' => env('DB_PORT', '5432'),
|
288
|
+
|
289
|
+
// 'database' => env('DB_DATABASE', 'forge'),
|
290
|
+
|
291
|
+
// 'username' => env('DB_USERNAME', 'forge'),
|
292
|
+
|
293
|
+
// 'password' => env('DB_PASSWORD', ''),
|
294
|
+
|
295
|
+
// 'charset' => 'utf8',
|
296
|
+
|
297
|
+
// 'prefix' => '',
|
298
|
+
|
299
|
+
// 'prefix_indexes' => true,
|
300
|
+
|
301
|
+
// 'schema' => 'public',
|
302
|
+
|
303
|
+
// 'sslmode' => 'prefer',
|
304
|
+
|
305
|
+
// ],
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
// 'sqlsrv' => [
|
310
|
+
|
311
|
+
// 'driver' => 'sqlsrv',
|
312
|
+
|
313
|
+
// 'url' => env('DATABASE_URL'),
|
314
|
+
|
315
|
+
// 'host' => env('DB_HOST', 'localhost'),
|
316
|
+
|
317
|
+
// 'port' => env('DB_PORT', '1433'),
|
318
|
+
|
319
|
+
// 'database' => env('DB_DATABASE', 'forge'),
|
320
|
+
|
321
|
+
// 'username' => env('DB_USERNAME', 'forge'),
|
322
|
+
|
323
|
+
// 'password' => env('DB_PASSWORD', ''),
|
324
|
+
|
325
|
+
// 'charset' => 'utf8',
|
326
|
+
|
327
|
+
// 'prefix' => '',
|
328
|
+
|
329
|
+
// 'prefix_indexes' => true,
|
330
|
+
|
331
|
+
// ],
|
332
|
+
|
333
|
+
|
334
|
+
|
335
|
+
],
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
/*
|
340
|
+
|
341
|
+
|--------------------------------------------------------------------------
|
342
|
+
|
343
|
+
| Migration Repository Table
|
344
|
+
|
345
|
+
|--------------------------------------------------------------------------
|
346
|
+
|
347
|
+
|
|
348
|
+
|
349
|
+
| This table keeps track of all the migrations that have already run for
|
350
|
+
|
351
|
+
| your application. Using this information, we can determine which of
|
352
|
+
|
353
|
+
| the migrations on disk haven't actually been run in the database.
|
354
|
+
|
355
|
+
|
|
356
|
+
|
357
|
+
*/
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
'migrations' => 'migrations',
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
/*
|
366
|
+
|
367
|
+
|--------------------------------------------------------------------------
|
368
|
+
|
369
|
+
| Redis Databases
|
370
|
+
|
371
|
+
|--------------------------------------------------------------------------
|
372
|
+
|
373
|
+
|
|
374
|
+
|
375
|
+
| Redis is an open source, fast, and advanced key-value store that also
|
376
|
+
|
377
|
+
| provides a richer body of commands than a typical key-value system
|
378
|
+
|
379
|
+
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
380
|
+
|
381
|
+
|
|
382
|
+
|
383
|
+
*/
|
384
|
+
|
385
|
+
|
386
|
+
|
387
|
+
'redis' => [
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
'client' => env('REDIS_CLIENT', 'phpredis'),
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
'options' => [
|
396
|
+
|
397
|
+
'cluster' => env('REDIS_CLUSTER', 'redis'),
|
398
|
+
|
399
|
+
'prefix' => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_database_'),
|
400
|
+
|
401
|
+
],
|
402
|
+
|
403
|
+
|
404
|
+
|
405
|
+
'default' => [
|
406
|
+
|
407
|
+
'url' => env('REDIS_URL'),
|
408
|
+
|
409
|
+
'host' => env('REDIS_HOST', '127.0.0.1'),
|
410
|
+
|
411
|
+
'password' => env('REDIS_PASSWORD', null),
|
412
|
+
|
413
|
+
'port' => env('REDIS_PORT', '6379'),
|
414
|
+
|
415
|
+
'database' => env('REDIS_DB', '0'),
|
416
|
+
|
417
|
+
],
|
418
|
+
|
419
|
+
|
420
|
+
|
421
|
+
'cache' => [
|
422
|
+
|
423
|
+
'url' => env('REDIS_URL'),
|
424
|
+
|
425
|
+
'host' => env('REDIS_HOST', '127.0.0.1'),
|
426
|
+
|
427
|
+
'password' => env('REDIS_PASSWORD', null),
|
428
|
+
|
429
|
+
'port' => env('REDIS_PORT', '6379'),
|
430
|
+
|
431
|
+
'database' => env('REDIS_CACHE_DB', '1'),
|
432
|
+
|
433
|
+
],
|
434
|
+
|
435
|
+
|
436
|
+
|
437
|
+
],
|
438
|
+
|
439
|
+
|
440
|
+
|
441
|
+
];
|
442
|
+
|
443
|
+
```
|
444
|
+
|
445
|
+
|
446
|
+
|
63
447
|
どのようなコードを見るべきかわかりません。
|
64
448
|
|
65
449
|
|