Exemplo n.º 1
0
 public function delete($id)
 {
     $category = Model\Kelas\Category::findOrFail($id);
     $category->delete();
     set_message_success('Kategori berhasil dihapus.');
     redirect('kelasonline/category', 'refresh');
 }
Exemplo n.º 2
0
 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');
     }
 }