Remove config repository usage

This commit is contained in:
Lance Pioch 2024-03-16 23:24:10 -04:00
parent 38d68d8221
commit 80d3827e4e

View File

@ -4,7 +4,6 @@ namespace App\Extensions;
use App\Models\DatabaseHost; use App\Models\DatabaseHost;
use Illuminate\Contracts\Encryption\Encrypter; use Illuminate\Contracts\Encryption\Encrypter;
use Illuminate\Config\Repository as ConfigRepository;
class DynamicDatabaseConnection class DynamicDatabaseConnection
{ {
@ -16,7 +15,6 @@ class DynamicDatabaseConnection
* DynamicDatabaseConnection constructor. * DynamicDatabaseConnection constructor.
*/ */
public function __construct( public function __construct(
protected ConfigRepository $config,
protected Encrypter $encrypter, protected Encrypter $encrypter,
) { ) {
} }
@ -32,7 +30,7 @@ class DynamicDatabaseConnection
$host = DatabaseHost::query()->findOrFail($host); $host = DatabaseHost::query()->findOrFail($host);
} }
$this->config->set('database.connections.' . $connection, [ config()->set('database.connections.' . $connection, [
'driver' => self::DB_DRIVER, 'driver' => self::DB_DRIVER,
'host' => $host->host, 'host' => $host->host,
'port' => $host->port, 'port' => $host->port,