Created
December 17, 2021 07:49
-
-
Save AaEzha/e67b9ed79deb0176d04f05b70e8f6db1 to your computer and use it in GitHub Desktop.
database.php configuration for Heroku deployment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| use Illuminate\Support\Str; | |
| $url = parse_url(getenv("CLEARDB_DATABASE_URL")); | |
| $host = $url["host"] ?? null; | |
| $username = $url["user"] ?? null; | |
| $password = $url["pass"] ?? null; | |
| $database = substr($url["path"], 1); | |
| return [ | |
| ... | |
| ... | |
| 'connections' => [ | |
| ... | |
| ... | |
| 'mysql' => [ | |
| ... | |
| ... | |
| 'host' => $host, | |
| 'port' => env('DB_PORT', '3306'), | |
| 'database' => $database, | |
| 'username' => $username, | |
| 'password' => $password, | |
| ... | |
| ... | |
| ], | |
| ... | |
| ... | |
| ], | |
| ... | |
| ... | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment