Hi there,
I am trying my hand at some front end forms and i have created a dataobject called Customers.
I can list my customers with the following code in the front end:
// Display list of customers
function ShowCustomers() {
return Customer::get();
}
But how do i delete a customer? At the moment i have this:
// Delete customer
function DeleteCustomer() {
$SQL_id = (int) $this->ID;
echo $SQL_id;
$page = DataObject::get_by_id('Customer', $SQL_id);
$page->setDelete(true);
Controller::curr()->redirectBack();
}
Thanks