public function deletecode() { if ($this->isPost()) { $data = $this->post(); $dc = DiscountCode::getByID($data['dcID']); if ($dc) { $ruleid = $dc->drID; $dc->remove(); $this->redirect('/dashboard/store/discounts/codes/' . $ruleid); } } $this->redirect('/dashboard/store/discounts/'); }