init
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
require __DIR__ . '/lib/redbean/rb-mysql.php';
|
||||
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
|
||||
/**
|
||||
* MySqlDatabaseService
|
||||
* @copyright 2021 Manaknightdigital Inc.
|
||||
* @link https://manaknightdigital.com
|
||||
* @license Proprietary Software licensing
|
||||
* @author Ryan Wong
|
||||
*
|
||||
*/
|
||||
class MySqlAdapter
|
||||
{
|
||||
private static $instance = null;
|
||||
private $_con;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$config = MkdConfig::get_instance()->get_config();
|
||||
R::setup("mysql:host={$config['database-hostname']};dbname={$config['database-name']}", "{$config['database-u-ser']}", "{$config['database-password']}");
|
||||
// R::debug(TRUE, 2);
|
||||
$this->_con = R::getToolBox();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Instance
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get_instance()
|
||||
{
|
||||
if (self::$instance == null) {
|
||||
self::$instance = new MySqlAdapter();
|
||||
}
|
||||
|
||||
return self::$instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Connection
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function get_connection()
|
||||
{
|
||||
return $this->_con;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user