Example #1
0
 /**
  * @param $keyName
  * @param ConfigDTO $config
  *
  * @return \Illuminate\Database\Capsule\Manager
  */
 public function setEloquentCapsule($keyName, ConfigDTO $config)
 {
     $this[$keyName] = $this->share(function () use($config) {
         /* Bootstrap Eloquent */
         $capsule = new Capsule();
         $capsule->addConnection($config->toArray());
         $capsule->setAsGlobal();
         /* Bootstrap end */
         return $capsule;
     });
     return $this[$keyName];
 }
 /**
  * @param array $config
  *
  * @throws \InvalidArgumentException
  * @return string
  */
 public static function build(ConfigDTO $config)
 {
     return $config->getDriver() . ":dbname=" . $config->getDbName() . ";host=" . $config->getHost() . ";";
 }