-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.php
executable file
·73 lines (58 loc) · 1.81 KB
/
bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
session_start();
require __DIR__ . "/vendor/autoload.php";
use Core\Middleware;
use Core\Whoops;
use Dotenv\Dotenv;
use Slim\App;
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
$config['displayErrorDetails'] = true;
$config['addContentLengthHeader'] = false;
$config['db'] = [
'driver' => 'mysql',
'host' => $_ENV["DB_HOST"],
'database' => $_ENV["DB_DATABASE"],
'username' => $_ENV["DB_USERNAME"],
'password' => $_ENV["DB_PASSWORD"],
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
$app = new App(['settings' => $config]);
$container = $app->getContainer();
$container['AdminController'] = function ($container) {
$service = new \App\Controller\Admin\AdminController($container);
return $service;
};
$container['ProfessorController'] = function ($container) {
$service = new \App\Controller\Admin\ProfessorController($container);
return $service;
};
$container['LoginController'] = function ($container) {
$service = new \App\Controller\Admin\LoginController($container);
return $service;
};
$container['PasswordRecoveryController'] = function ($container) {
$service = new \App\Controller\Admin\PasswordRecoveryController($container);
return $service;
};
$container['PostController'] = function ($container) {
$service = new \App\Controller\Admin\PostController($container);
return $service;
};
$container['CategoryController'] = function ($container) {
$service = new \App\Controller\Admin\CategoryController($container);
return $service;
};
$container['db'] = function ($container) {
$config = $container->get('settings');
$capsule = new \Illuminate\Database\Capsule\Manager;
$capsule->addConnection($config["db"]);
$capsule->setAsGlobal();
$capsule->bootEloquent();
return $capsule;
};
$whoops = new Whoops();
$whoops->run($container);
$middleware = new Middleware();