public function register(PimpleContainer $app)
    {
        $app['capsule.connectionDefault'] = [
            'driver' => 'mysql',
            'host' => 'localhost',
            'port' => 3306,
            'database' => null,
            'username' => null,
            'password' => null,
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ];

        $app['capsule.connections'] = [];

        $app['capsule.container'] = function (PimpleContainer $app) {
            return new CapsuleContainer();
        };

        $app['capsule.dispatcher'] = function (PimpleContainer $app) {
            return new Dispatcher($app['capsule.container']);
        };

        $app['capsule.options'] = [
            'setAsGlobal' => true,
            'bootEloquent' => true,
            'enableQueryLog' => true,
        ];

        $app['capsule'] = function (PimpleContainer $app) {
            $capsule = new Capsule($app['capsule.container']);

            // Set the event dispatcher used by Eloquent models...
            if (!empty($app['capsule.dispatcher'])) {
                $capsule->setEventDispatcher($app['capsule.dispatcher']);
            }

            // Connections
            foreach ($app['capsule.connections'] as $connectionName => $connectionConfig) {
                $connectionConfig += $app['capsule.connectionDefault'];
                $capsule->addConnection($connectionConfig, $connectionName);

                if ($app['capsule.options']['enableQueryLog']) {
                    $capsule->getConnection($connectionName)->enableQueryLog();
                }
            }

            // Make this Capsule instance available globally via static methods...
            if (!empty($app['capsule.options']['setAsGlobal'])) {
                $capsule->setAsGlobal();
            }

            // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
            if (!empty($app['capsule.options']['bootEloquent'])) {
                $capsule->bootEloquent();
            }

            return $capsule;
        };
    }
public function register(PimpleContainer $app)
    {
        $app['capsule.connectionDefault'] = [
            'driver' => 'mysql',
            'host' => 'localhost',
            'port' => 3306,
            'database' => null,
            'username' => null,
            'password' => null,
            'charset' => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix' => '',
            'strict' => false,
            'engine' => null,
        ];

        $app['capsule.connections'] = [];

        $app['capsule.container'] = function (PimpleContainer $app) {
            return new CapsuleContainer();
        };

        $app['capsule.dispatcher'] = function (PimpleContainer $app) {
            return new Dispatcher($app['capsule.container']);
        };

        $app['capsule.options'] = [
            'setAsGlobal' => true,
            'bootEloquent' => true,
            'enableQueryLog' => true,
        ];

        $app['capsule'] = function (PimpleContainer $app) {
            $capsule = new Capsule($app['capsule.container']);

            // Set the event dispatcher used by Eloquent models...
            if (!empty($app['capsule.dispatcher'])) {
                $capsule->setEventDispatcher($app['capsule.dispatcher']);
            }

            // Connections
            foreach ($app['capsule.connections'] as $connectionName => $connectionConfig) {
                $connectionConfig += $app['capsule.connectionDefault'];
                $capsule->addConnection($connectionConfig, $connectionName);

                if ($app['capsule.options']['enableQueryLog']) {
                    $capsule->getConnection($connectionName)->enableQueryLog();
                }
            }

            // Make this Capsule instance available globally via static methods...
            if (!empty($app['capsule.options']['setAsGlobal'])) {
                $capsule->setAsGlobal();
            }

            // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher())
            if (!empty($app['capsule.options']['bootEloquent'])) {
                $capsule->bootEloquent();
            }

            return $capsule;
        };
    }
public function register ( PimpleContainer $ app ) { $ app [ 'capsule.connectionDefault' ] = [ 'driver' => 'mysql' , 'host' => 'localhost' , 'port' => 3306 , 'database' => null , 'username' => null , 'password' => null , 'charset' => 'utf8' , 'collation' => 'utf8_unicode_ci' , 'prefix' => '' , 'strict' => false , 'engine' => null , ] ; $ app [ 'capsule.connections' ] = [ ] ; $ app [ 'capsule.container' ] = function ( PimpleContainer $ app ) { return new CapsuleContainer ( ) ; } ; $ app [ 'capsule.dispatcher' ] = function ( PimpleContainer $ app ) { return new Dispatcher ( $ app [ 'capsule.container' ] ) ; } ; $ app [ 'capsule.options' ] = [ 'setAsGlobal' => true , 'bootEloquent' => true , 'enableQueryLog' => true , ] ; $ app [ 'capsule' ] = function ( PimpleContainer $ app ) { $ capsule = new Capsule ( $ app [ 'capsule.container' ] ) ; // Set the event dispatcher used by Eloquent models... if ( ! empty ( $ app [ 'capsule.dispatcher' ] ) ) { $ capsule -> setEventDispatcher ( $ app [ 'capsule.dispatcher' ] ) ; } // Connections foreach ( $ app [ 'capsule.connections' ] as $ connectionName => $ connectionConfig ) { $ connectionConfig += $ app [ 'capsule.connectionDefault' ] ; $ capsule -> addConnection ( $ connectionConfig , $ connectionName ) ; if ( $ app [ 'capsule.options' ] [ 'enableQueryLog' ] ) { $ capsule -> getConnection ( $ connectionName ) -> enableQueryLog ( ) ; } } // Make this Capsule instance available globally via static methods... if ( ! empty ( $ app [ 'capsule.options' ] [ 'setAsGlobal' ] ) ) { $ capsule -> setAsGlobal ( ) ; } // Setup the Eloquent ORM... (optional; unless you've used setEventDispatcher()) if ( ! empty ( $ app [ 'capsule.options' ] [ 'bootEloquent' ] ) ) { $ capsule -> bootEloquent ( ) ; } return $ capsule ; } ; }
Register the Capsule Service.

@param PimpleContainer $app
Register the Capsule Service .