Created
September 13, 2016 15:45
-
-
Save carlosocarvalho/c4a3c8d7a3680d30c6a0b8d81124fb9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Controller Demo for user Register events. | |
* | |
*/ | |
class Register extends CI_Controller{ | |
public function __construct(){ | |
parent::__construct(); | |
} | |
/** | |
* | |
* @return html response | |
*/ | |
public function index(){ | |
$this->load->view('user/register'); | |
} | |
/** | |
* | |
* | |
*/ | |
public function store(){ | |
$data = $this->input->post(); | |
$this->load->model('User/RegisterModel'); | |
if( $this->RegisterModel->insert('users', $data) ) | |
Events::trigger('create:user'); | |
} | |
public function update(){ | |
$data = $this->input->post(); | |
$this->load->model('User/RegisterModel'); | |
if( $this->RegisterModel->update('users', ['id'=>1], $data) ) | |
Events::trigger('update:user'); | |
} | |
public function destroy( $id ){ | |
$this->load->model('User/RegisterModel'); | |
if( $this->RegisterModel->delete('users', ['id'=> $id]) ) | |
Events::trigger('delete:user'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment