Skip to content

Commit

Permalink
[8.x] Support database_url for php artisan db command (#37064)
Browse files Browse the repository at this point in the history
* handle database url

* Update DbCommand.php

Co-authored-by: mmabdelgawad <mahmoud.abdelgawad@izam.co>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
3 people authored Apr 20, 2021
1 parent 2dfcec5 commit c607db9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Illuminate/Database/Console/DbCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Illuminate\Database\Console;

use Illuminate\Console\Command;
use Illuminate\Support\ConfigurationUrlParser;
use Symfony\Component\Process\Process;
use UnexpectedValueException;

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

if (! empty($connection['url'])) {
$connection = (new ConfigurationUrlParser)->parseConfiguration($connection);
}

return $connection;
}

Expand Down

0 comments on commit c607db9

Please sign in to comment.