This commit is contained in:
Juan Pablo Vial
2023-07-24 20:41:38 -04:00
parent 6ab24c8961
commit be33305cf1
612 changed files with 11436 additions and 107 deletions

View File

@ -0,0 +1,2 @@
<?php
$app->add($app->getContainer()->get(App\Middleware\Auth::class));

View File

@ -0,0 +1,20 @@
<?php
function loadDatabase(object $settings, string $name): void
{
$port = 3306;
if (isset($settings->port)) {
$port = $settings->port;
}
$dsn = 'mysql:host=' . $settings->host . ';port=' . $port . ';dbname=' . $settings->database . ';charset=utf8';
ORM::configure($dsn, null, $name);
ORM::configure('username', $settings->username, $name);
ORM::configure('password', $settings->password, $name);
}
$databases = $app->getContainer()->get('databases');
foreach ($databases as $name => $settings) {
loadDatabase($settings, $name);
}
Model::$short_table_names = true;

View File

@ -0,0 +1,2 @@
<?php
Monolog\ErrorHandler::register($app->getContainer()->get(Psr\Log\LoggerInterface::class));

View File

@ -0,0 +1,15 @@
<?php
function buildRoutes(&$app) {
$folder = implode(DIRECTORY_SEPARATOR, [
$app->getContainer()->get('folders')->get('routes'),
'ui'
]);
$files = new FilesystemIterator($folder);
foreach ($files as $file) {
if ($file->isDir()) {
continue;
}
include_once $file->getRealPath();
}
}
buildRoutes($app);