Skip to content

Commit

Permalink
Check if .env exists
Browse files Browse the repository at this point in the history
  • Loading branch information
barryvdh committed Dec 30, 2024
1 parent dd5236e commit 42ce4ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"orchestra/testbench": "^9.2",
"phpunit/phpunit": "^10.5",
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
"vimeo/psalm": "^5.4"
"vimeo/psalm": "^5.4",
"vlucas/phpdotenv": "^5"
},
"suggest": {
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)."
Expand Down
7 changes: 6 additions & 1 deletion src/Console/MetaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,13 @@ protected function getOptions()

protected function getEnv()
{
$envPath = base_path('.env');
if (!file_exists($envPath)) {
return [];
}

$parser = new Parser();
$entries = $parser->parse(file_get_contents(base_path('.env')));
$entries = $parser->parse(file_get_contents($envPath));

return collect($entries)->map(function (Entry $entry) {
return $entry->getName();
Expand Down

0 comments on commit 42ce4ca

Please sign in to comment.