Support the ongoing development of Laravel.io →
Installation Configuration Database
Last updated 2 years ago.
0

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!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.