public function delete($id) { $category = Model\Kelas\Category::findOrFail($id); $category->delete(); set_message_success('Kategori berhasil dihapus.'); redirect('kelasonline/category', 'refresh'); }
public function edit($id) { $category = Model\Kelas\Category::findOrFail($id); $data['category'] = $category; $this->form_validation->set_rules('name', 'Nama Kategori', 'required'); if ($this->form_validation->run() == FALSE) { $this->template->build('category_edit', $data); } else { $category->update(['name' => set_value('name')]); set_message_success('Kategori berhasil diperbarui.'); redirect('kelasonline/category', 'refresh'); } }