/**
  * 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;
         });
     }
 }
Example #2
0
 /**
  * Redirects to a new page.
  *
  */
 function debug($value = '', $tag = '', $type = 'info', $object = null)
 {
     $debug = debugbar();
     return $debug->message($value, $tag, $type, $object);
 }
 public function getFakeSms()
 {
     debugbar()->disable();
     return '1701:' . mt_rand(1000000, 99999999);
 }
 public function __construct()
 {
     debugbar()->disable();
 }