Illuminate\Database\Connection::getDatabaseName PHP Метод

getDatabaseName() публичный Метод

Get the name of the connected database.
public getDatabaseName ( ) : string
Результат string
    public function getDatabaseName()
    {
        return $this->database;
    }

Usage Example

Пример #1
0
 /**
  *
  * @param string $query
  * @param array $bindings
  * @param float $time
  * @param \Illuminate\Database\Connection $connection
  */
 public function addQuery($query, $bindings, $time, $connection)
 {
     $explainResults = array();
     $time = $time / 1000;
     $endTime = microtime(true);
     $startTime = $endTime - $time;
     $hints = $this->performQueryAnalysis($query);
     $pdo = $connection->getPdo();
     $bindings = $connection->prepareBindings($bindings);
     // Run EXPLAIN on this query (if needed)
     if ($this->explainQuery && preg_match('/^(' . implode($this->explainTypes) . ') /i', $query)) {
         $statement = $pdo->prepare('EXPLAIN ' . $query);
         $statement->execute($bindings);
         $explainResults = $statement->fetchAll(\PDO::FETCH_CLASS);
     }
     $bindings = $this->checkBindings($bindings);
     if (!empty($bindings) && $this->renderSqlWithParams) {
         foreach ($bindings as $binding) {
             $query = preg_replace('/\\?/', $pdo->quote($binding), $query, 1);
         }
     }
     $source = null;
     if ($this->findSource) {
         try {
             $source = $this->findSource();
         } catch (\Exception $e) {
         }
     }
     $this->queries[] = array('query' => $query, 'bindings' => $this->escapeBindings($bindings), 'time' => $time, 'source' => $source, 'explain' => $explainResults, 'connection' => $connection->getDatabaseName(), 'hints' => $this->showHints ? $hints : null);
     if ($this->timeCollector !== null) {
         $this->timeCollector->addMeasure($query, $startTime, $endTime);
     }
 }
All Usage Examples Of Illuminate\Database\Connection::getDatabaseName