/** * Gets the value of the specified configuration data. * * @param string $prop The configuration data to get. Dot delimited values for sub-configuration data is allowed and * passed through {@link ObjectUtil::getDeepValue()}. * @param mixed $fallback A fallback value to use if the requested property does not exist. * * @return mixed */ public function get($prop = null, $fallback = null) { if ($prop === null) { // Return entire dataset on an argumentless call. return $fallback === null ? $this->_data : $fallback; } return ObjectUtil::getDeepValue($this->_data, $prop, $fallback); }
public function __construct() { $config = Tempest::get()->config->get('db'); if (!empty($config)) { $config = array_merge(array('driver' => 'mysql', 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci'), $config); $connection = $this->parseConnectionString(ObjectUtil::getDeepValue($config, 'connection')); $connection = array_merge($config, $connection); $this->_capsule = new Manager(); $this->_capsule->addConnection($connection); $this->_capsule->setAsGlobal(); $this->_capsule->bootEloquent(); } else { throw new Exception('No database connection details were provided by the application.'); } }