<?php
	defined('BASEPATH') OR exit('No direct script access allowed');

	class Hc_distributors extends My_Model{
		protected $_table_name = 'hc_distributors';
		protected $_order_by = 'id';

		public function __construct(){
			parent::__construct();
		}


		public function get_new(){
			$distributors = new stdClass();
			$distributors->first_name = '';
			$distributors->last_name = '';
			$distributors->email = '';
			$distributors->mobile_number = '';
			$distributors->expiry_date = date('Y-m-d', strtotime('+3 months', strtotime(Date("Y-m-d"))));
			$distributors->is_active = '1';


			return $distributors;
		}


		public $rules = array(

			'first_name' => array(
				'field' => 'first_name', 
				'label' => 'first name', 
				'rules' => 'trim|required|xss_clean'
			),

			'last_name' => array(
				'field' => 'last_name', 
				'label' => 'last name', 
				'rules' => 'trim|required|xss_clean'
			),

			'email' => array(
				'field' => 'email', 
				'label' => 'email', 
				'rules' => 'trim|required|xss_clean'
			)
		);

		public function hash($string){
			return hash('sha512', $string . config_item('encryption_key'));
		}
	}
?>