/** * [copyTable description] * * @method copyTable * * @param [type] $to [description] * * @return [type] [description] */ public function copyTable($to) { if (fnmatch('*.*', $to)) { list($newDb, $newTable) = explode('.', $to, 2); } else { $newDb = $this->db; $newTable = $to; } $new = new self($newDb, $newTable); $rows = $this->cursor(); foreach ($rows as $row) { unset($row['id']); $new->firstOrCreate($row); } return $new; }