diff --git a/application/controllers/Categories.php b/application/controllers/Categories.php index c52b883..1e56596 100644 --- a/application/controllers/Categories.php +++ b/application/controllers/Categories.php @@ -13,7 +13,9 @@ public function index(){ public function create(){ $data['title'] = 'Create Category'; - $this->form_validation->set_rules('name', 'Name', 'required'); + $this->form_validation->set_rules('name', 'Name', 'required|is_unique[categories.name]', array( + 'is_unique' => 'This Category already exists.' + )); if($this->form_validation->run() === FALSE){ $this->load->view('templates/header'); @@ -34,4 +36,4 @@ public function posts($id){ $this->load->view('posts/index', $data); $this->load->view('templates/footer'); } - } \ No newline at end of file + }