Assert that a given where condition does not exist in the database.

@param string $table
@param array  $data
@param string $connection

@return $this
510594
protected function notSeeInDatabase($table, array $data, $connection = null)
    {
        if (is_null($this->app)) {
            return; // don't run when there is no application
        }

        $database = $this->app->make('db');

        $connection = $connection ?: $database->getDefaultConnection();

        $count = $database->connection($connection)->table($table)->where($data)->count();

        $this->assertEquals(0, $count, sprintf(
            'Found unexpected records in database table [%s] that matched attributes [%s].', $table, json_encode($data)
        ));

        return $this;
    }
1210542
protected function assertDatabaseHas($table, array $data, $onConnection = null)
    {
        return $this->seeInDatabase($table, $data, $onConnection);
    }
193288
public function update($table, array $data, array $conditions)
    {
        $table = $this->getTable($table);
        $set = $this->buildSqlObject($data, ', ');
        $where = $this->buildSqlObject($conditions, ' AND ');

        $query = "UPDATE $table SET $set WHERE $where";
        $params = array_merge(array_values($data), array_values($conditions));
        return $this->executeUpdate($query, $params);
    }
366852
public function databaseCompile($data, $table)
    {
        $rule = 'unique';
        $passed = call_user_func_array([new databaseRules(), $rule], [$data['field'], $data['value'], $table]);
        if ($passed !== true) {
            Handler::set(
                    str_replace(':field', $data['field'], $this->messages[$rule]), $data['field']);
        }
    }
361781
public function setCurrentConnection($connection = null, $server = null)
    {
        $connectionKey = $connection instanceof ConnectionKey ? $connection : $this->credentials->createConnectionKey($connection, $server);
        if ($this->current === $connectionKey->toHandle()) {
            return;
        }

        $this->current = $connectionKey->toHandle();
        $this->available = $this->getConnections()->map(function (ConnectionInterface $connection) use ($connectionKey) {
            $isCurrent = $connectionKey->is($connection->getConnectionKey());
            $connection->setCurrent($isCurrent);

            return $connection;
        });

        // Update events
        $this->bootstrapper->bootstrapUserCode();
    }
1041594
public function tableExists($tableName, $connectionName = 'default')
    {
        try {
            $db = ConnectionManager::get($connectionName);
            $collection = $db->schemaCollection();
            $tables = $collection->listTables();
            if (in_array($tableName, $tables)) {
                return true;
            }
        } catch (PDOException $connectionError) {
            return false;
        }
        return false;
    }
528559
public function update($table, array $data)
    {
        $this->queryBuilder->update($table, $this->asData($data));
        return $this;
    }
1271056
public static function drop($table, $connection = null)
	{
		$table = new Table($table);

		$table->on($connection);

		// To indicate that the table needs to be dropped, we will run the
		// "drop" command on the table instance and pass the instance to
		// the execute method as calling a Closure isn't needed.
		$table->drop();

		return static::execute($table);
	}
1325111
public function update($table, $data = false)
    {
        if ($data == false) {
            $data = $table;
        } else {
            $this->table($table);
        }

        // Escape SQL 
        foreach ($data as $key => $value) {
            $data[$key] = $this->quote($value);
        }

        $this->queryCompiler->getQuery()->update($data);

        $this->queryCompiler->compile('update');

        return $this->getResult('get');
    }
1232737
protected function assertSoftDeleted($table, array $data, $connection = null)
    {
        $this->assertThat(
            $table, new SoftDeletedInDatabase($this->getConnection($connection), $data)
        );

        return $this;
    }
715713
public function insert_or_update( $table, $data, $where ) {
		if ( ! isset( $this->table_defines[ $table ] ) ) {
			return false;
		}

		if ( $this->is_logical( $this->table_defines[ $table ] ) ) {
			$where['deleted_at'] = null;
		}

		$row = $this->select_row( $table, $where, 'id' );
		if ( empty( $row ) ) {
			$this->insert( $table, $data );
			if ( $this->get_last_error() ) {
				return false;
			}

			return $this->get_insert_id();
		}
		$where = [ 'id' => $row['id'] ];
		$this->update( $table, $data, $where );
		if ( $this->get_last_error() ) {
			return false;
		}

		return $row['id'];
	}
1203958
protected function ensureCommandsAreValid(Connection $connection)
    {
        if ($connection instanceof SQLiteConnection) {
            if ($this->commandsNamed(['dropColumn', 'renameColumn'])->count() > 1) {
                throw new BadMethodCallException(
                    "SQLite doesn't support multiple calls to dropColumn / renameColumn in a single modification."
                );
            }

            if ($this->commandsNamed(['dropForeign'])->count() > 0) {
                throw new BadMethodCallException(
                    "SQLite doesn't support dropping foreign keys (you would need to re-create the table)."
                );
            }
        }
    }
401870
function record_exists($table, $data) {
		if (!empty($this->prefix) && !(substr_count($table,$this->prefix) > 0)) {
			$table = $this->prefix."_".$table;
        }
		$pairs = array();
		foreach($data as $key => $value) {
			if (!is_numeric($value)) {
				$pairs[] = $this->encapsulate_column_name($key)." = '".$this->escape($value)."'";
			} else {
				$pairs[] = $this->encapsulate_column_name($key)." = $value";
			}
		}
		$where = implode(" AND ", $pairs);
		$records = $this->select("*",$table,$data);
		if ($records->num_rows > 0) {
			return $records;
		} else {
			return false;
		}
	}
707647
public function updateBatch(string $table, $data, $where): ?PDOStatement
	{
		// Get the generated values and sql string
		list($sql, $data) = $this->driver->updateBatch($table, $data, $where);

		return $sql !== NULL
			? $this->_run('', $table, $sql, $data)
			: NULL;
	}
1168454
protected function dontSeeInDatabase($table, array $data, $connection = null)
    {
        return $this->notSeeInDatabase($table, $data, $connection);
    }
1238258
public static function table( $table, $connection = null )
	{
		return self::getInstance()->getConnection($connection)->table($table);
	}
951395
public static function insert($table, $data = null) {
        if ($data !== null) {
            return Insert::insert($table, $data);
        } else {
            return Insert::table($table);
        }
    }