Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Ardakilic committed Sep 16, 2015
1 parent abc825b commit 610e4d0
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions README.md
Expand Up @@ -261,6 +261,48 @@ $container['phpmig.migrations_path'] = function() {
return $container;
```

Example with Eloquent ORM 5.1
------------------
```php
<?php

use \Phpmig\Adapter;
use \Phpmig\Pimple\Pimple,
\Illuminate\Database\Capsule\Manager as Capsule;

$container = new Pimple();

$container['config'] = [
'driver' => 'xxx',
'host' => 'xxx',
'database' => 'xxx',
'username' => 'xxx',
'password' => 'x',
'charset' => 'xxx',
'collation' => 'xxx',
'prefix' => '',
];

$container['db'] = $container->share(function() use ($container) {
$capsule = new Capsule();
$capsule->addConnection($container['config']);
$capsule->setAsGlobal();
$capsule->bootEloquent();

return $capsule;
});

$container['phpmig.adapter'] = $container->share(function() use ($container) {
return new Adapter\Illuminate\Database($container['db'], 'migrations');
});
$container['phpmig.migrations_path'] = function() {
return __DIR__ . DIRECTORY_SEPARATOR . 'migrations';
};

return $container;
```


Writing Migrations
------------------

Expand Down

0 comments on commit 610e4d0

Please sign in to comment.