Skip to content

Update a Row

Gilberto Junior edited this page Nov 29, 2019 · 2 revisions

This method updates data from registry by ID.

Syntax

public function update(array $data, int $id): Model|bool;

Example

$instance = $repository->update([
    'email' => '[email protected]',
], 1);

if ($instance === false) {
    echo 'User #1 not found'; 
} else {
    echo 'Data updated with new email ' . $instance->email;
}

🡄 Insert a Row | Delete By IDs 🡆