src/Table.php
public function offsetSet($offset, $value): Row
    {
        //Insert on missing offset
        if ($offset === null) {
            $value['id'] = null;

            return $this->create($value)->save();
        }

        //Update if the element is cached and exists
        $row = $this->getCached($offset);

        if ($row) {
            return $row->edit($value)->save();
        }

        //Update if the element it's not cached
        if (!$this->isCached($row)) {
            $this->update()
                ->columns($value)
                ->where('id = ', $offset)
                ->run();
        }
    }
public function offsetSet($offset, $value): Row
    {
        //Insert on missing offset
        if ($offset === null) {
            $value['id'] = null;

            return $this->create($value)->save();
        }

        //Update if the element is cached and exists
        $row = $this->getCached($offset);

        if ($row) {
            return $row->edit($value)->save();
        }

        //Update if the element it's not cached
        if (!$this->isCached($row)) {
            $this->update()
                ->columns($value)
                ->where('id = ', $offset)
                ->run();
        }
    }
Store a row with a specific id.

@see ArrayAccess
@param mixed $offset
@param mixed $value