Skip to content

Commit c607db9

Browse files
Mahmoud Abdelgawadmmabdelgawadtaylorotwell
authored
[8.x] Support database_url for php artisan db command (#37064)
* handle database url * Update DbCommand.php Co-authored-by: mmabdelgawad <[email protected]> Co-authored-by: Taylor Otwell <[email protected]>
1 parent 2dfcec5 commit c607db9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Illuminate/Database/Console/DbCommand.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Illuminate\Database\Console;
44

55
use Illuminate\Console\Command;
6+
use Illuminate\Support\ConfigurationUrlParser;
67
use Symfony\Component\Process\Process;
78
use UnexpectedValueException;
89

@@ -57,6 +58,10 @@ public function getConnection()
5758
throw new UnexpectedValueException("Invalid database connection [{$db}].");
5859
}
5960

61+
if (! empty($connection['url'])) {
62+
$connection = (new ConfigurationUrlParser)->parseConfiguration($connection);
63+
}
64+
6065
return $connection;
6166
}
6267

0 commit comments

Comments
 (0)