/** * Register the service provider. * * @return void */ public function register() { $params = array('database' => DB_NAME, 'username' => DB_USER, 'password' => DB_PASSWORD, 'prefix' => $GLOBALS['table_prefix']); if (class_exists('Corcel\\Database')) { Database::connect($params); } }
/** * Register any application services. * * @return void */ public function register() { if (class_exists('\\Corcel\\Database')) { \Corcel\Database::connect(['host' => getenv('DB_HOST'), 'database' => getenv('DB_DATABASE'), 'username' => getenv('DB_USERNAME'), 'password' => getenv('DB_PASSWORD'), 'prefix' => 'wp_']); } View::share('errors', new MessageBag([])); // if ($this->app->environment() == 'local') { $this->app->register('Laracasts\\Generators\\GeneratorsServiceProvider'); } }
public function wordpress_db_connection() { $wordpressDB = Config::get('database.connections')[Config::get('database.wordpress')]; $params = array('database' => $wordpressDB['database'], 'username' => $wordpressDB['username'], 'password' => $wordpressDB['password'], 'prefix' => 'wp_'); return Database::connect($params); }
<?php require __DIR__ . '/../../vendor/autoload.php'; \Corcel\Database::connect(array('database' => 'corcel-dev', 'username' => 'root', 'password' => '123456', 'host' => '127.0.0.1'));
/** * Connect to the dummy database. */ public function connect() { Database::connect(['driver' => 'sqlite', 'database' => __DIR__ . '/dummy.sqlite', 'prefix' => 'wp_']); }
<?php require __DIR__ . '/../../vendor/autoload.php'; $capsule = \Corcel\Database::connect($params = ['database' => 'corcel', 'username' => 'root', 'password' => '', 'host' => '127.0.0.1']); $capsule->addConnection(array_merge($params, ['driver' => 'mysql', 'host' => 'localhost', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '']), 'no_prefix'); // $corcel = new \Corcel\Database\Manager(); // $corcel->addConnection([ // 'database' => 'corcel', // 'username' => 'homestead', // 'password' => 'secret', // 'host' => '127.0.0.1', // ], 'corcel');