Example #1
0
 /**
  * Provides a shared instance of the Query Builder.
  *
  * @param string $table
  *
  * @return BaseBuilder|Database\QueryBuilder
  */
 protected function builder(string $table = null)
 {
     if ($this->builder instanceof BaseBuilder) {
         return $this->builder;
     }
     $table = empty($table) ? $this->table : $table;
     // Ensure we have a good db connection
     if (!$this->db instanceof BaseConnection) {
         $this->db = Database::connect($this->DBGroup);
     }
     $this->builder = $this->db->table($table);
     return $this->builder;
 }
 /**
  * Removes a single history
  *
  * @param string $version
  * @param string $group     The database group
  */
 protected function removeHistory($version, $group = 'default')
 {
     $this->db->table($this->table)->where('version', $version)->where('group', $group)->delete();
 }