$start) { $this->counters[$group] = $start; } } /** * Get the next increment number from a group * @param $group * @return int */ public function getNextOrderNumber($group) { if(!isset($this->counters[$group])) { return 0; } $idx = $this->counters[$group]; ++$this->counters[$group]; return $idx; } /** * Add rows to a table * @param $table * @param $rows */ public function addData($table, $rows) { foreach ($rows as $row) { try { DB::table($table)->insert($row); } catch (Exception $e) { # setting already exists, just ignore it if ($e->getCode() === 23000) { continue; } } } } }