-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheloquent.php
More file actions
31 lines (24 loc) · 764 Bytes
/
eloquent.php
File metadata and controls
31 lines (24 loc) · 764 Bytes
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
<?php
declare(strict_types = 1);
use Dotenv\Dotenv;
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
require_once __DIR__ . '/vendor/autoload.php';
$dotenv = Dotenv::createImmutable(__DIR__);
$dotenv->load();
$capsule = new Capsule;
$params = [
'host' => $_ENV['DB_HOST'],
'username' => $_ENV['DB_USER'],
'password' => $_ENV['DB_PASS'],
'database' => $_ENV['DB_DATABASE'],
'driver' => $_ENV['DB_DRIVER'] ?? 'mysql',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
$capsule->addConnection($params);
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->setAsGlobal();
$capsule->bootEloquent();