Skip to content

Instantly share code, notes, and snippets.

@AaEzha
Created December 17, 2021 07:49
Show Gist options
  • Select an option

  • Save AaEzha/e67b9ed79deb0176d04f05b70e8f6db1 to your computer and use it in GitHub Desktop.

Select an option

Save AaEzha/e67b9ed79deb0176d04f05b70e8f6db1 to your computer and use it in GitHub Desktop.
database.php configuration for Heroku deployment
<?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