Skip to content

Commit 9659368

Browse files
committed
Add support for configuring database prefix
Currently it's not possible to set the database prefix without overriding the config file in the application, it seems like allowing it to be set at the environment level out of the box would be a clean addition, as it's a fairly common requirement.
1 parent 53a6cb7 commit 9659368

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

config/database.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
'sqlite' => [
5555
'driver' => 'sqlite',
5656
'database' => storage_path('database.sqlite'),
57-
'prefix' => '',
57+
'prefix' => env('DB_PREFIX', ''),
5858
],
5959

6060
'mysql' => [
@@ -65,7 +65,7 @@
6565
'password' => env('DB_PASSWORD', ''),
6666
'charset' => 'utf8',
6767
'collation' => 'utf8_unicode_ci',
68-
'prefix' => '',
68+
'prefix' => env('DB_PREFIX', ''),
6969
'timezone' => '+00:00',
7070
'strict' => false,
7171
],
@@ -77,7 +77,7 @@
7777
'username' => env('DB_USERNAME', 'forge'),
7878
'password' => env('DB_PASSWORD', ''),
7979
'charset' => 'utf8',
80-
'prefix' => '',
80+
'prefix' => env('DB_PREFIX', ''),
8181
'schema' => 'public',
8282
],
8383

@@ -87,7 +87,7 @@
8787
'database' => env('DB_DATABASE', 'forge'),
8888
'username' => env('DB_USERNAME', 'forge'),
8989
'password' => env('DB_PASSWORD', ''),
90-
'prefix' => '',
90+
'prefix' => env('DB_PREFIX', ''),
9191
],
9292

9393
],

0 commit comments

Comments
 (0)