Controller
isDelete()
Signature
Section titled “Signature”isDelete() — returns boolean
Available in: controller
Category: Miscellaneous Functions
Description
Section titled “Description”Checks if the current HTTP request method is DELETE. This is useful for RESTful controllers where different logic is executed based on the request type.
Examples
Section titled “Examples”component extends="Controller" {
public void function destroy() {
if (isDelete()) {
// Perform deletion logic
model("Post").deleteByKey(params.id);
flashInsert(success="Post deleted successfully.");
redirectTo(action="index");
} else {
// Handle non-DELETE request
flashInsert(error="Invalid request method.");
redirectTo(action="index");
}
}
}