/**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     CmfDbModel::setDbConnectionConfig(DbConnectionConfig::create()->setDriver(env('DB_CONNECTION', 'pgsql'))->setHost(env('DB_HOST', 'localhost'))->setDbName(env('DB_DATABASE'))->setUserName(env('DB_USERNAME'))->setPassword(env('DB_PASSWORD')));
     DbColumnConfig::registerType('password', DbColumnConfig::DB_TYPE_VARCHAR, PasswordField::class);
     /*if (app()->offsetExists('debugbar') && debugbar()->isEnabled()) {
           $timeCollector = (debugbar()->hasCollector('time')) ? debugbar()->getCollector('time') : null;
           $pdoCollector = new PDOCollector(null, $timeCollector);
           $pdoCollector->setRenderSqlWithParams(true);
           debugbar()->addCollector($pdoCollector);
           Db::setConnectionWrapper(function (Db $db, \PDO $pdo) {
               $pdoTracer = new TraceablePDO($pdo);
               if (debugbar()->hasCollector('pdo')) {
                   debugbar()->getCollector('pdo')->addConnection($pdoTracer, $db->getDbName());
               }
               return $pdoTracer;
           });
       }*/
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  * @throws \DebugBar\DebugBarException
  * @throws \PeskyORM\Exception\DbConnectionConfigException
  */
 public function boot()
 {
     $driver = config('database.default');
     CmfDbModel::setDbConnectionConfig(DbConnectionConfig::create()->setDriver($driver)->setHost(config("database.connections.{$driver}.host"))->setDbName(config("database.connections.{$driver}.database"))->setUserName(config("database.connections.{$driver}.username"))->setPassword(config("database.connections.{$driver}.password")));
     DbColumnConfig::registerType('password', DbColumnConfig::DB_TYPE_VARCHAR, PasswordField::class);
     if (config('app.debug', false) && app()->offsetExists('debugbar') && debugbar()->isEnabled()) {
         $timeCollector = debugbar()->hasCollector('time') ? debugbar()->getCollector('time') : null;
         $pdoCollector = new PDOCollector(null, $timeCollector);
         $pdoCollector->setRenderSqlWithParams(true);
         debugbar()->addCollector($pdoCollector);
         Db::setConnectionWrapper(function (Db $db, \PDO $pdo) {
             $pdoTracer = new PeskyOrmPdoTracer($pdo);
             if (debugbar()->hasCollector('pdo')) {
                 debugbar()->getCollector('pdo')->addConnection($pdoTracer, $db->getDbName());
             }
             return $pdoTracer;
         });
     }
 }