This commit is contained in:
zimoyin
2026-04-01 15:07:15 +08:00
commit ac95dbb1c8
55 changed files with 11634 additions and 0 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace app\config;
use Illuminate\Database\Connection;
use support\Db;
class DatabaseConfig
{
public string $host = 'localhost' {
get {
return $this->host;
}
}
public string $username = 'root' {
get {
return $this->username;
}
}
public string $password = '' {
get {
return $this->password;
}
}
public string $database = 'opm_ectms' {
get {
return $this->database;
}
}
public function __construct()
{
$this->host = getenv('DB_HOST');
$this->username = getenv('DB_USER');
$this->password = getenv('DB_PASSWORD');
$this->database = getenv('DB_NAME');
}
/**
* @param $connection string|null
* @return Connection
*/
public function getConnection(?string $connection = null): Connection
{
return Db::connection($connection);
}
}