public function delete() { $success = false; try { $suggestion = Suggestion::find(Input::get("id")); $suggestion->delete(); $success = true; $response = "Registro eliminado correctamente."; } catch (Exception $ex) { $response = "No se ha podido eliminar el registro seleccionado. " . $ex->getMessage(); } return Response::json(array("response" => $response, "success" => $success)); }
public static function toggleProcessed($id) { if (self::get_user_admin() == null) { Redirect::to('/home'); } $suggestion = Suggestion::find($id); if (!$suggestion->processed) { $suggestion->processed = 1; } else { $suggestion->processed = 0; } $suggestion->update(); Redirect::to('/suggestions', array('message' => 'Updated!')); }