mini\Database\PartialQuery::update()
Method
public
Signature
public function update(mini\Table\Contracts\TableInterface $query, array $changes): int
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$query |
mini\Table\Contracts\TableInterface |
required | Documentation missing |
$changes |
array |
required | Documentation missing |
Returns
int
Documentation
Update rows matching this query
Updates are scoped to rows matching this query's WHERE clause. The $query parameter allows additional filtering within that scope.
$users = db()->query('SELECT * FROM users WHERE org_id = ?', [5]);
$users->update($users->eq('active', false), ['status' => 'inactive']);
// Only updates inactive users within org_id = 5