For anyone who has this same problem, this is the code I used in the .env.local.php file:
$dbCreds = [
'DB_NAME' => '', //Your db name for this project
// Don't change these here - override in app/config/local/database.php
'DB_HOST' => 'localhost',
'DB_USERNAME' => 'homestead',
'DB_PASSWORD' => 'secret',
];
# On the command line, we don't always have access to the values set in the Homestead.yaml
foreach ($dbCreds as $k => $v)
{
// If there is already an env set, then remove the default above
if (getenv($k)) unset($dbCreds[$k]);
}
return $dbCreds;
Please feel free to criticise/ridicule if you have a better way!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community