Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Home extends CI_Controller {
- public function index() {
- if ($this->session->userdata('is_logged_in')==FALSE) {
- redirect('Signin/signin');
- } else {
- $this->customers();
- }
- }
- public function customers(){
- // More code here
- }
- }
- class Home extends CI_Controller {
- public function index() {
- if ($this->session->userdata('is_logged_in')==FALSE) {
- redirect('Signin/signin');
- } else {
- $this->customers();
- $this->create();
- $this->save();
- $this->edit($customer_id);
- $this->update($customer_id);
- $this->delete($customer_id);
- }
- }
- public function customers(){
- // More code here
- }
- public function edit($customer_id){
- // More code here
- }
- /* The rest of
- the functions
- here */
- }
- class Home extends CI_Controller {
- public function __construct(){
- parent::__construct();
- //instead of checking the user whether he is logged in, in every function, check it in the constructor
- if (!$this->session->userdata('is_logged_in')) {
- redirect('Signin/signin');
- }
- }
- //function to show customer lists
- public function index() {
- $this->load->view('customer_list_view');
- }
- Now if the user wants to add a customer, add a function to show the form
- //customer add form view
- public function add_customer(){
- //show form view
- $this->load->view('customer_list_view');
- }
- //save customer
- public function save_customer(){
- //save or update based the availability of the user to the database
- }
- //delete customer
- public function delete_customer(){
- //delete the customer here
- }
Add Comment
Please, Sign In to add comment