protected function updateModel(
        Model $model,
        Resource $resource,
        string $route = null
    ) {
        $model->fill($resource->data);

        $result = $model->update(array_keys($resource->data));
        if ($result === true) {
            return;
        }

        $message = "Resource '" . ($route ?? $resource->route)
            . "' could not be updated";

        if (is_string($result)) {
            $message .= ": Database failure ($result)";
        }

        $this->sendError(static::ERROR_INTERNAL_SERVER, $message);
    }
protected function updateModel(
        Model $model,
        Resource $resource,
        string $route = null
    ) {
        $model->fill($resource->data);

        $result = $model->update(array_keys($resource->data));
        if ($result === true) {
            return;
        }

        $message = "Resource '" . ($route ?? $resource->route)
            . "' could not be updated";

        if (is_string($result)) {
            $message .= ": Database failure ($result)";
        }

        $this->sendError(static::ERROR_INTERNAL_SERVER, $message);
    }
protected function updateModel ( Model $ model , Resource $ resource , string $ route = null ) { $ model -> fill ( $ resource -> data ) ; $ result = $ model -> update ( array_keys ( $ resource -> data ) ) ; if ( $ result === true ) { return ; } $ message = "Resource '" . ( $ route ?? $ resource -> route ) . "' could not be updated" ; if ( is_string ( $ result ) ) { $ message .= ": Database failure ($result)" ; } $ this -> sendError ( static :: ERROR_INTERNAL_SERVER , $ message ) ; }
Updates a Model

@param Model    $model    Model to be updated
@param Resource $resource Resource that loaded $model
@param string   $route    Alternative route to $model

@throws RouterException If could not update the Model
Updates a Model