/** * This method is used to delete an emoji from the database * @param Slim $app [Slim instance] * @param $id [the id of the emoji in the emojis table] * @return json encoded string */ public static function deleteEmoji(Slim $app, $id) { $app->response->headers->set('Content-Type', 'application/json'); Authenticator::authenticate($app); $rows = Emoji::destroyById($id); if (is_string($rows)) { OutputFormatter::formatOutput($app, 404, $rows); } if ($rows > 0) { OutputFormatter::formatOutput($app, 200, "Emoji with ID {$id} deleted successfully."); } else { OutputFormatter::formatOutput($app, 400, "Failed to delete Emoji with ID {$id}."); } }
/** * A simple logout function * @param Slim $app */ public static function logout(Slim $app) { Authenticator::authenticate($app); OutputFormatter::formatOutput($app, 200, "You've logged out successfully."); }