Beispiel #1
0
    $resolver = new \Illuminate\Database\ConnectionResolver(array('default' => $connection));
    $resolver->addConnection('app', $connection);
    $resolver->setDefaultConnection('default');
    DLModel::setConnectionResolver($resolver);
    DLModel::setEventDispatcher($event_dispatcher);
    $connection->setEventDispatcher($event_dispatcher);
} else {
    //
    // Create SQLite database
    //
    if ($db_config['driver'] == 'sqlite') {
        touch($db_config['database']);
    }
    $capsule = new Illuminate\Database\Capsule\Manager();
    $capsule->addConnection($db_config);
    $capsule->setFetchMode(PDO::FETCH_CLASS);
    $capsule->setEventDispatcher($event_dispatcher);
    $capsule->setAsGlobal();
    $capsule->bootEloquent();
    $connection = $capsule->connection();
    class_alias('\\Illuminate\\Database\\Eloquent\\Model', 'DLModel');
}
//
// Setup default date format
// Use a string representing an RFC2822 or ISO 8601 date
// http://tools.ietf.org/html/rfc2822#page-14
//
\Carbon\Carbon::setToStringFormat('Y-m-d\\TH:i:sP');
// Setup paginator
$connection->setPaginator(new Hook\Pagination\Environment());
// Setup Schema Grammar