public function listTables() { $tables = DB::getDoctrineSchemaManager()->listTables(); $data = []; foreach ($tables as $table) { $data[] = $table->getName(); } return $data; }
protected function truncate($table = null) { if (is_string($table)) { return DB::table($table)->delete(); } $tables = DB::getDoctrineSchemaManager()->listTableNames(); foreach ($tables as $table) { if ($this->isVerbose()) { $this->info('Truncating ' . $table); } DB::table($table)->delete(); } }
/** * @return Table[] The tables, either from cache or from the DoctrineSchemaManager. */ private function getTables() { if ($this->tables == null) { if (Cache::has(self::KEY_TABLE_INFO)) { $this->tables = Cache::get(self::KEY_TABLE_INFO); } else { $this->tables = array(); $doctrineSchemaManager = DB::getDoctrineSchemaManager(); $tables = $doctrineSchemaManager->listTables(); /* @var $tables Table[] */ foreach ($tables as $table) { $this->tables[$table->getName()] = $table; } Cache::put(self::KEY_TABLE_INFO, $this->tables, 1); } } return $this->tables; }
/** * Get column. * * @return string */ public function getColumns() { return DB::getDoctrineSchemaManager()->listTableDetails($this->getTable())->getColumns(); }