-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.php
52 lines (40 loc) · 1.08 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
<?php
use Dotenv\Dotenv;
use FastRoute\RouteCollector;
use Illuminate\Database\Capsule\Manager as CapsuleManager;
use Zend\Diactoros\Response\SapiEmitter;
include 'vendor/autoload.php';
define('APP_ROOT', __DIR__);
/**
* Load dependency injection container
* @var \DI\Container $container
*/
$container = require 'di/container.php';
/**
* Load environment variables
*/
try {
$dotenv = new Dotenv(APP_ROOT);
$dotenv->load();
}
catch (\Dotenv\Exception\InvalidPathException $e) {
//
}
/**
* Load Eloquent ORM
*/
$capsule = new CapsuleManager();
$capsule->addConnection([
'driver' => config('database.driver'),
'host' => config('database.host'),
'database' => config('database.database'),
'username' => config('database.username'),
'password' => config('database.password'),
'charset' => config('database.charset'),
'collation' => config('database.collation'),
'prefix' => config('database.prefix'),
]);
// Make this Capsule instance available globally via static methods
$capsule->setAsGlobal();
// Setup the Eloquent ORM
$capsule->bootEloquent();