Add TuxiNet branding and document templates

This commit is contained in:
Thomas
2025-10-28 13:56:54 +01:00
parent f956a735ca
commit 3755435890
48 changed files with 1762 additions and 1 deletions

44
app/Core/Database.php Normal file
View File

@@ -0,0 +1,44 @@
<?php
namespace App\Core;
use PDO;
use PDOException;
class Database
{
private static ?PDO $connection = null;
public static function connection(): PDO
{
if (self::$connection === null) {
$config = config('database');
$dsn = sprintf(
'mysql:host=%s;port=%s;dbname=%s;charset=utf8mb4',
$config['host'],
$config['port'],
$config['database']
);
$options = [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
PDO::ATTR_EMULATE_PREPARES => false,
];
try {
self::$connection = new PDO(
$dsn,
$config['username'],
$config['password'],
$options
);
} catch (PDOException $exception) {
throw new \RuntimeException('Database connection failed: ' . $exception->getMessage());
}
}
return self::$connection;
}
}