public static function update($id) { $params = $_POST; $attributes = array('id' => $id, 'description' => $params['description'], 'time' => $params['time'], 'place' => $params['place']); $Event = new Event($attributes); $errors = $Event->errors(); if (count($errors) != 0) { View::make('/Event/edit.html', array('errors' => $errors, 'attributes' => $attributes)); } else { $Event->update(); Redirect::to('/event/' . $Event->id, array('message' => 'Tapahtumaa on muokattu onnistuneesti!')); } }