Skip to content

Instantly share code, notes, and snippets.

@carlosocarvalho
Created September 13, 2016 15:45
Show Gist options
  • Save carlosocarvalho/c4a3c8d7a3680d30c6a0b8d81124fb9f to your computer and use it in GitHub Desktop.
Save carlosocarvalho/c4a3c8d7a3680d30c6a0b8d81124fb9f to your computer and use it in GitHub Desktop.
<?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