-
Notifications
You must be signed in to change notification settings - Fork 0
/
phpmig.php
35 lines (27 loc) · 846 Bytes
/
phpmig.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
<?php
use \Phpmig\Adapter;
use Pimple\Container;
use Illuminate\Database\Capsule\Manager as Capsule;
$container = new Container();
$container['config'] = [
'driver' => 'mysql',
'host' => 'eloquent_db_server',
'database' => 'dev_eloquent',
'username' => 'root',
'password' => 'eloquent',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
];
$container['db'] = function ($c) {
$capsule = new Capsule();
$capsule->addConnection($c['config']);
$capsule->setAsGlobal();
$capsule->bootEloquent();
return $capsule;
};
$container['phpmig.adapter'] = function($c) {
return new Adapter\Illuminate\Database($c['db'], 'migrations');
};
$container['phpmig.migrations_path'] = __DIR__ . DIRECTORY_SEPARATOR . 'resources/database/migrations';
return $container;