first commit

This commit is contained in:
ryanwong
2022-06-30 05:46:02 -04:00
commit a96eaec33b
859 changed files with 199842 additions and 0 deletions
+235
View File
@@ -0,0 +1,235 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Admin_operation_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Admin_operation_model extends Manaknight_Model
{
protected $_table = 'admin_operation';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'action',
'detail',
'last_ip',
'user_agent',
];
protected $_label_fields = [
'ID','User','Action','Detail','Last IP','User Agent',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User', 'required|integer'],
['action', 'Action', 'required|max[50]'],
['detail', 'Detail', 'required'],
['last_ip', 'Last IP', 'required'],
['user_agent', 'User Agent', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User', ''],
['action', 'Action', ''],
['detail', 'Detail', ''],
['last_ip', 'Last IP', ''],
['user_agent', 'User Agent', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['last_ip'] = $this->get_ip();
$data['last_ip'] = $this->get_user_agent();
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
function get_ip()
{
if(!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function get_user_agent()
{
return $_SERVER['HTTP_USER_AGENT'];
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
public function getMemberAccountData(){
$data = [
'month'=>0,
'week'=>0,
'year'=>0,
'total'=>0
];
$result = $this->db->select('count(*) as count')->from('phinxlog')->where('breakpoint',0)->get()->row_array();
if($result){
$data['total'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('credential')->where('role_id',2)->where('MONTH(created_at) =',date('n'))
->where('YEAR(created_at)',date('Y'))->get()->row_array();
if($result){
$data['month'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('credential')->where('role_id',1)
->where('YEAR(created_at) =',date('Y'))->get()->row_array();
if($result){
$data['year'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('credential')->where('role_id',1)
->where('YEARWEEK(created_at, 1) = YEARWEEK(CURDATE(), 1)')->get()->row_array();
if($result){
$data['week'] = $result['count'];
}
return $data;
}
public function getMemberUploadData(){
$data = [
'month'=>0,
'week'=>0,
'year'=>0,
'total'=>0
];
$result = $this->db->select('count(id) as count')->from('inventory')->where('status',1)->get()->row_array();
if($result){
$data['total'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('inventory')->where('status',1)->where('MONTH(created_at) =',date('n'))
->where('YEAR(created_at)',date('Y'))->get()->row_array();
if($result){
$data['month'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('inventory')->where('status',1)
->where('YEAR(created_at) =',date('Y'))->get()->row_array();
if($result){
$data['year'] = $result['count'];
}
$result = $this->db->select('count(id) as count')->from('inventory')->where('status',1)
->where('YEARWEEK(created_at, 1) = YEARWEEK(CURDATE(), 1)')->get()->row_array();
if($result){
$data['week'] = $result['count'];
}
return $data;
}
public function getAccountsBySchool(){
$result = $this->db->select('count(c.id) as count,s.name as school')->from('credential c')
->join('member_profile m','m.user_id=c.user_id')
->join('school s','s.id=m.school_id','left')
->where('c.role_id',1)
->group_by('m.school_id')
->order_by('count')
->limit(5)
->get()->result_array();
return $result;
}
public function getUploadsBySchool(){
$result = $this->db->select('count(i.id) as count,s.name as school')->from('inventory i')
->join('school s','s.id=i.school_id')
->where('i.status',1)
->group_by('i.school_id')
->order_by('count')
->limit(5)
->get()->result_array();
return $result;
}
}
+98
View File
@@ -0,0 +1,98 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Cart_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Cart_model extends Manaknight_Model
{
protected $_table = 'cart';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'inventory_id',
'user_id',
'session_id',
'subtotal',
'total',
];
protected $_label_fields = [
'ID','Inventory ID','User ID','Session ID','Subtotal','Total',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['inventory_id', 'Inventory ID', 'required|integer'],
['user_id', 'User ID', 'required|integer'],
['session_id', 'Session ID', ''],
['subtotal', 'Subtotal', 'required'],
['total', 'Total', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['inventory_id', 'Inventory ID', 'required|integer'],
['user_id', 'User ID', 'required|integer'],
['session_id', 'Session ID', ''],
['subtotal', 'Subtotal', 'required'],
['total', 'Total', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Category_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Category_model extends Manaknight_Model
{
protected $_table = 'category';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'status',
];
protected $_label_fields = [
'ID','Name','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Classes_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Classes_model extends Manaknight_Model
{
protected $_table = 'classes';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'status',
];
protected $_label_fields = [
'ID','Name','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+92
View File
@@ -0,0 +1,92 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Contact_us_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Contact_us_model extends Manaknight_Model
{
protected $_table = 'contact_us';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'email',
'message',
];
protected $_label_fields = [
'ID','Name','Email','Reason',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['message', 'Reason', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['message', 'Reason', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+112
View File
@@ -0,0 +1,112 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Content_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Content_model extends Manaknight_Model
{
protected $_table = 'content';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'content_name',
'content_type',
'content',
'status',
];
protected $_label_fields = [
'ID','Content Name','Content Type','Content','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['content_name', 'Content Name', 'required'],
['content_type', 'Content Type', 'required|integer'],
['content', 'Content', 'required'],
['status', 'Status', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['content_name', 'Content Name', 'required'],
['content_type', 'Content Type', 'required|integer'],
['content', 'Content', 'required'],
['status', 'Status', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function content_type_mapping ()
{
return [
1 => 'Text',
2 => 'Image',
3 => 'Link',
];
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+106
View File
@@ -0,0 +1,106 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Cookies_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Cookies_model extends Manaknight_Model
{
protected $_table = 'cookies';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'name',
'value',
'expire',
'domain',
];
protected $_label_fields = [
'ID','User ID','Name','Value','Expire at','xyzdomain',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['name', 'Name', ''],
['value', 'Value', ''],
['expire', 'Expire at', ''],
['domain', 'xyzdomain', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['name', 'Name', ''],
['value', 'Value', ''],
['expire', 'Expire at', ''],
['domain', 'xyzdomain', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
0 => 'Inactive',
1 => 'Active',
];
}
}
+154
View File
@@ -0,0 +1,154 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Credential_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Credential_model extends Manaknight_Model
{
protected $_table = 'credential';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'email',
'password',
'type',
'verify',
'role_id',
'user_id',
'status',
];
protected $_label_fields = [
'ID','Email','Password','xyzType','Verified','Role','xUser','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['email', 'Email', 'trim|required|valid_email'],
['password', 'Password', 'required'],
['type', 'xyzType', ''],
['verify', 'Verified', ''],
['role_id', 'Role', ''],
['user_id', 'xUser', ''],
['status', 'Status', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['email', 'Email', 'trim|required|valid_email'],
['password', 'Password', ''],
['type', 'xyzType', ''],
['verify', 'Verified', ''],
['role_id', 'Role', ''],
['user_id', 'xUser', ''],
['status', 'Status', 'required|in_list[0,1,2]'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['status'] = 1;
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function verify_mapping ()
{
return [
0 => 'Not verified',
1 => 'Verified',
];
}
public function status_mapping ()
{
return [
0 => 'Inactive',
1 => 'Active',
2 => 'Suspend',
];
}
public function role_id_mapping ()
{
return [
1 => 'Member',
2 => 'Admin',
];
}
public function type_mapping ()
{
return [
'n' => 'Normal',
'f' => 'Facebook',
'g' => 'Google',
];
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+107
View File
@@ -0,0 +1,107 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Dispute_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Dispute_model extends Manaknight_Model
{
protected $_table = 'dispute';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'order_id',
'user_id',
'amount',
'reason',
'explanation',
'stripe_charge_id',
'stripe_dispute_id',
'status',
];
protected $_label_fields = [
'ID','Order ID','User ID','Amount','Reason','Explanation','Stripe Charge ID','Stripe Dispute ID','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['user_id', 'User ID', ''],
['amount', 'Amount', ''],
['reason', 'Reason', ''],
['explanation', 'Explanation', ''],
['stripe_charge_id', 'Stripe Charge ID', ''],
['stripe_dispute_id', 'Stripe Dispute ID', ''],
['status', 'Status', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['user_id', 'User ID', ''],
['amount', 'Amount', ''],
['reason', 'Reason', ''],
['explanation', 'Explanation', ''],
['stripe_charge_id', 'Stripe Charge ID', ''],
['stripe_dispute_id', 'Stripe Dispute ID', ''],
['status', 'Status', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+141
View File
@@ -0,0 +1,141 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Email_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Email_model extends Manaknight_Model
{
protected $_table = 'email';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'slug',
'email_header',
'email_footer',
'subject',
'tag',
'html',
];
protected $_label_fields = [
'ID','Email Type','Body Header','Body Footer','Subject','Replacement Tags','Email Body',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['slug', 'Email Type', 'required|is_unique[email.slug]'],
['email_header', 'Body Header', 'required'],
['email_footer', 'Body Footer', 'required'],
['subject', 'Subject', 'required'],
['tag', 'Replacement Tags', 'required'],
['html', 'Email Body', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['slug', 'Email Type', ''],
['email_header', 'Body Header', 'required'],
['email_footer', 'Body Footer', 'required'],
['subject', 'Subject', 'required'],
['tag', 'Replacement Tags', ''],
['html', 'Email Body', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
if(isset($data['slug']))
{
unset($data['slug']);
}
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function get_template($slug,$data)
{
$this->db->from('email');
$this->db->where('slug',$slug,TRUE);
$template=$this->db->get()->row();
if(!$template)
{
return FALSE;
}
$tags_raw=$template->tag;
$tags=explode(',',$tags_raw);
$template->subject=$this->inject_substitute($template->subject,$tags,$data);
$html = $template->email_header . $template->html . $template->email_footer;
$template->html = $this->inject_substitute($html, $tags, $data);
return $template;
}
public function inject_substitute($raw, $tags, $data)
{
foreach ($data as $key => $value)
{
if (in_array($key, $tags) || $key == 'logo')
{
if ($key == 'logo')
{
$logo = base_url('assets/frontend/img/logo.png');
$new_val = "<img src='" . $logo . "' style='width:158px' />";
$value = $new_val;
}
$raw = str_replace('{{{' . $key . '}}}', $value, $raw);
}
}
return $raw;
}
}
+156
View File
@@ -0,0 +1,156 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Image_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Image_model extends Manaknight_Model
{
protected $_table = 'image';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'url',
'caption',
'user_id',
'width',
'height',
'type',
];
protected $_label_fields = [
'ID','URL','Caption','xUser','Width','Height','Image Type',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['url', 'URL', 'required'],
['caption', 'Caption', ''],
['user_id', 'xUser', 'required|integer'],
['width', 'Width', ''],
['height', 'Height', ''],
['type', 'Image Type', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['url', 'URL', 'required'],
['caption', 'Caption', ''],
['user_id', 'xUser', 'required|integer'],
['width', 'Width', ''],
['height', 'Height', ''],
['type', 'Image Type', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
if(!isset($data['url_id']))
{
unset($data['url_id']);
}
if(!isset($data['caption']))
{
$data['caption'] = '';
}
if(!isset($data['width']))
{
$data['width'] = 0;
}
if(!isset($data['height']))
{
$data['height'] = 0;
}
if(!isset($data['type']))
{
$data['type'] = 0;
}
if(!isset($data['user_id']) || $data['user_id'] == 0)
{
$data['user_id'] = 1;
}
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
if(!isset($data['url_id']))
{
unset($data['url_id']);
}
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function type_mapping ()
{
return [
0 => 'Server Hosted',
1 => 'External Link',
2 => 'S3',
3 => 'Cloudinary',
4 => 'File',
5 => 'External File',
6 => 'Video',
];
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+103
View File
@@ -0,0 +1,103 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Inventory_gallery_image_list_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Inventory_gallery_image_list_model extends Manaknight_Model
{
protected $_table = 'inventory_gallery_image_list';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'inventory_id',
'gallery_image',
'gallery_image_id',
'status',
];
protected $_label_fields = [
'ID','Inventory ID','Gallery Image','Image ID','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['inventory_id', 'Inventory ID', 'required|integer'],
['gallery_image', 'Gallery Image', 'required'],
['gallery_image_id', 'Image ID', ''],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['inventory_id', 'Inventory ID', 'required|integer'],
['gallery_image', 'Gallery Image', 'required'],
['gallery_image_id', 'Image ID', ''],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+437
View File
@@ -0,0 +1,437 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Inventory_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Inventory_model extends Manaknight_Model
{
protected $_table = 'inventory';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'title',
'school_id',
'professor_id',
'class_id',
'textbook_id',
'word_count',
'year',
'isbn',
'paypal_email',
'file',
'file_id',
'feature_image',
'feature_image2',
'feature_image3',
'feature_image_id',
'note_type',
'description',
'inventory_note',
'pin_to_top',
'approve',
'status'
];
protected $_label_fields = [
'ID', 'Title', 'School ID', 'Professor ID', 'Class ID', 'Textbook ID', 'Word Count', 'Year', 'ISBN', 'Paypal Email', 'File', 'File ID', 'Feature Image', 'Feature Image ID', 'Note Type', 'Description', 'Inventory Note', 'Pin to top', 'Approve', 'Status'
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
// ['title', 'Title', 'required'],
['school_id', 'School ', 'required|integer'],
['professor_id', 'Professor', 'required|integer'],
['class_id', 'Course ', 'required|integer'],
// ['textbook_id', 'Textbook ', ''],
['word_count', 'Word Count', 'required|integer'],
['year', 'Year', 'required|integer'],
['isbn', 'ISBN', ''],
// ['paypal_email', 'Paypal Email', 'required'],
// ['file', 'Outline', 'required'],
// ['file_id', 'File ID', ''],
// ['feature_image', 'Preview File', 'required'],
// ['feature_image_id', 'Feature Image ID', ''],
['note_type', 'Note Type', 'required'],
['description', 'Description', ''],
['inventory_note', 'Inventory Note', ''],
['pin_to_top', 'Pin to top', ''],
['approve', 'Approve', ''],
['status', 'Status', '']
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
// ['title', 'Title', 'required'],
['school_id', 'School', 'required|integer'],
['professor_id', 'Professor', 'required|integer'],
['class_id', 'Class', 'required|integer'],
// ['textbook_id', 'ISBN', 'required|integer'],
['word_count', 'Word Count', 'required'],
['year', 'Year', 'required'],
// ['isbn', 'ISBN', ''],
// ['paypal_email', 'Paypal Email', 'required'],
// ['file', 'File', 'required'],
// ['file_id', 'File ID', ''],
// ['feature_image', 'Feature Image', 'required'],
// ['feature_image_id', 'Feature Image ID', ''],
['note_type', 'Note Type', 'required'],
['description', 'Description', ''],
['inventory_note', 'Inventory Note', ''],
['pin_to_top', 'Pin to top', ''],
['approve', 'Approve', ''],
['status', 'Status', '']
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function note_type_mapping()
{
return [
1 => 'Outline',
2 => 'Lecture Notes'
];
}
public function pin_to_top_mapping()
{
return [
0 => 'No',
1 => 'Yes'
];
}
public function approve_mapping()
{
return [
1 => 'Yes',
0 => 'No'
];
}
public function status_mapping()
{
return [
1 => 'Active',
0 => 'Inactive',
2 => 'Removed'
];
}
// frontend functions
public function get_all_active_items_list_fe($search_term = '', $school_id = '', $professor_id = '', $textbook_id = '', $class_id = '',$isbn='',$order_by='',$direction='', $offset = '', $limit = '')
{
$this->db->from('inventory');
$this->db->join('school', 'inventory.school_id = school.id', 'LEFT');
$this->db->join('professor', 'inventory.professor_id = professor.id', 'LEFT');
$this->db->join('textbook', 'inventory.textbook_id = textbook.id', 'LEFT');
$this->db->join('classes', 'inventory.class_id = classes.id', 'LEFT');
$this->db->join('user', 'inventory.user_id = user.id', 'LEFT');
$this->db->join('review', 'inventory.id = review.inventory_id', 'LEFT');
$this->db->select('inventory.*,sum(review.rating) as rating,count(review.id) as rating_count,user.first_name ,school.name AS school_name,classes.name AS class_name,textbook.name AS textbook_name,textbook.isbn AS textbook_isbn,professor.name AS professor_name');
$this->db->where('inventory.status', 1);
$this->db->where('school.status', 1);
$this->db->group_by('inventory.id');
if($order_by && $direction)
{
if(in_array($order_by,['school_id','isbn','class_id','professor_id','textbook_id','year','word_count','note_type']))
{
$this->db->order_by($order_by, $direction);
}else if($order_by=='seller'){
$this->db->order_by('user.first_name', $direction);
}else if($order_by=='review'){
$this->db->order_by('rating', $direction);
}
}
else
{
$this->db->order_by('inventory.created_at', 'DESC');
}
if ($search_term)
{
$query = $this->db->where(' (inventory.title like "%'.$search_term.'%" or
classes.name like "%'.$search_term.'%" or
school.name like "%'.$search_term.'%" or
textbook.name like "%'.$search_term.'%" or
professor.name like "%'.$search_term.'%" )');
}
if ($school_id)
{
$query = $this->db->where('inventory.school_id', $school_id);
}
if ($professor_id)
{
$query = $this->db->where('inventory.professor_id', $professor_id);
}
if ($textbook_id)
{
$query = $this->db->where('inventory.textbook_id', $textbook_id);
}
if ($isbn)
{
$query = $this->db->where('inventory.isbn', $isbn);
}
if ($class_id)
{
$query = $this->db->where('inventory.class_id', $class_id);
}
if ($limit)
{
$this->db->limit($limit, $offset);
}
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result();
}
return FALSE;
}
public function get_current_user_order_count($user_id){
return $this->db->select('count(id) as order_count,inventory_id')->from('order')->where('status',1)->where('sale_user_id',$user_id)->group_by('inventory_id')->get()->result_array();
}
public function get_current_user_refunded_count($user_id){
return $this->db->select('count(id) as order_count,inventory_id')->from('order')->where('status',2)->where('sale_user_id',$user_id)->group_by('inventory_id')->get()->result_array();
}
public function get_all_active_items_by_school_list_fe($school_id, $offset = '', $limit = '')
{
$this->db->from('inventory');
$this->db->join('school', 'inventory.school_id = school.id', 'BOTH');
$this->db->select('inventory.*, school.id AS school_id, school.name AS school_name');
$this->db->where('inventory.school_id', $school_id);
$this->db->where('inventory.status', 1);
$this->db->where('school.status', 1);
$this->db->order_by('school.created_at', 'DESC');
$this->db->order_by('inventory.created_at', 'DESC');
if ($limit != '')
{
$this->db->limit($limit, $offset);
}
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result();
}
return FALSE;
}
public function get_item_details_fe($id)
{
$this->db->select('inventory.*, school.id AS school_id, school.name AS school_name');
$this->db->from('inventory');
$this->db->join('school', 'inventory.school_id = school.id');
$this->db->where('inventory.id', $id);
$this->db->where('inventory.status', 1);
$this->db->where('school.status', 1);
$data = $this->db->get()->row();
// die($this->db->last_query());
if ($data)
{
return $data;
}
return FALSE;
}
/**
* Count number of model
*
* @access public
* @param mixed $parameters
* @return integer $result
*/
public function count($parameters)
{
$this->db->select('user.first_name, user.last_name, credential.email, inventory.* ');
if (!empty($parameters))
{
foreach ($parameters as $key => $value)
{
if (is_numeric($key) && strlen($value) > 0)
{
$this->db->where($value);
continue;
}
if ($key === NULL && $value === NULL)
{
continue;
}
if (!is_null($value))
{
if(is_numeric($value))
{
$this->db->where($key, $value);
continue;
}
if(is_string($value))
{
$this->db->like($key, $value);
continue;
}
$this->db->where($key, $value);
}
}
}
$this->db->join('user', 'inventory.user_id = user.id', 'LEFT');
$this->db->join('credential', 'user.id = credential.user_id', 'LEFT');
$this->_custom_counting_conditions($this->db);
$this->db->from($this->_table);
return $this->db->count_all_results();
}
/**
* Get paginated model
*
* @access public
* @param integer $page default 0
* @param integer $limit default 10
* @return array
*/
public function get_paginated($page = 0, $limit=10, $where=[], $order_by='', $direction='ASC')
{
$this->db->limit($limit, $page);
if ($order_by === '')
{
$order_by = $this->_primary_key;
}
$this->db->select('user.first_name, user.last_name, credential.email, inventory.* ');
$this->db->order_by($this->clean_alpha_num_field($order_by), $this->clean_alpha_field($direction));
if (!empty($where))
{
foreach($where as $field => $value)
{
if (is_numeric($field) && strlen($value) > 0)
{
$this->db->where($value);
continue;
}
if ($field === NULL && $value === NULL)
{
continue;
}
if ($value !== NULL)
{
if(is_numeric($value))
{
$this->db->where($field, $value);
continue;
}
if(is_string($value))
{
$this->db->like($field, $value);
continue;
}
$this->db->where($field, $value);
}
}
}
$this->db->join('user', 'inventory.user_id = user.id', 'LEFT');
$this->db->join('credential', 'user.id = credential.user_id', 'LEFT');
$query = $this->db->get($this->_table);
$result = [];
if ($query->num_rows() > 0)
{
foreach ($query->result() as $row)
{
$result[] = $row;
}
}
return $result;
}
}
+143
View File
@@ -0,0 +1,143 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Marketing_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Marketing_model extends Manaknight_Model
{
protected $_table = 'marketing';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'password_protect',
'content_template_path',
'header_template_path',
'footer_template_path',
'title',
'seo_title',
'seo_description',
'content',
'status',
'publish_date',
'slug',
];
protected $_label_fields = [
'ID','User Id','Page Password','Template','Header Template','Footer Template','Title','SEO Title','SEO Description','Content','Status','Published Date','URL',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User Id', ''],
['password_protect', 'Page Password', ''],
['content_template_path', 'Template', ''],
['header_template_path', 'Header Template', ''],
['footer_template_path', 'Footer Template', ''],
['title', 'Title', 'required'],
['seo_title', 'SEO Title', 'required'],
['seo_description', 'SEO Description', 'required'],
['content', 'Content', 'required'],
['status', 'Status', ''],
['publish_date', 'Published Date', ''],
['slug', 'URL', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User Id', ''],
['password_protect', 'Page Password', ''],
['content_template_path', 'Template', ''],
['header_template_path', 'Header Template', ''],
['footer_template_path', 'Footer Template', ''],
['title', 'Title', 'required'],
['seo_title', 'SEO Title', 'required'],
['seo_description', 'SEO Description', 'required'],
['content', 'Content', 'required'],
['status', 'Status', ''],
['publish_date', 'Published Date', ''],
['slug', 'URL', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
0 => 'Public',
1 => 'Private',
2 => 'Inactive',
];
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+136
View File
@@ -0,0 +1,136 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Member_operation_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_operation_model extends Manaknight_Model
{
protected $_table = 'member_operation';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'action',
'detail',
'last_ip',
'user_agent',
];
protected $_label_fields = [
'ID','User','Action','Detail','Last IP','User Agent',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User', 'required|integer'],
['action', 'Action', 'required|max[50]'],
['detail', 'Detail', 'required'],
['last_ip', 'Last IP', 'required'],
['user_agent', 'User Agent', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User', ''],
['action', 'Action', ''],
['detail', 'Detail', ''],
['last_ip', 'Last IP', ''],
['user_agent', 'User Agent', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['last_ip'] = $this->get_ip();
$data['last_ip'] = $this->get_user_agent();
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
function get_ip()
{
if(!empty($_SERVER['HTTP_CLIENT_IP']))
{
$ip = $_SERVER['HTTP_CLIENT_IP'];
}
elseif(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
else
{
$ip = $_SERVER['REMOTE_ADDR'];
}
return $ip;
}
function get_user_agent()
{
return $_SERVER['HTTP_USER_AGENT'];
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+107
View File
@@ -0,0 +1,107 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Member_profile_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Member_profile_model extends Manaknight_Model
{
protected $_table = 'member_profile';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'username',
'school_id',
];
protected $_label_fields = [
'ID','User ID','Username','School ID',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['username', 'Username', 'required'],
['school_id', 'School ID', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['username', 'Username', 'required'],
['school_id', 'School ID', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+95
View File
@@ -0,0 +1,95 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Notification_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Notification_model extends Manaknight_Model
{
protected $_table = 'notification';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'message',
'url',
'read_status',
];
protected $_label_fields = [
'Id','User ID','Reason','xyzurl','xyzread_status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['message', 'Reason', 'required'],
['url', 'xyzurl', ''],
['read_status', 'xyzread_status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['message', 'Reason', 'required'],
['url', 'xyzurl', ''],
['read_status', 'xyzread_status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+129
View File
@@ -0,0 +1,129 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Order_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Order_model extends Manaknight_Model
{
protected $_table = 'order';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'purchase_user_id',
'sale_user_id',
'inventory_id',
'order_date',
'order_time',
'subtotal',
'tax',
'discount',
'total',
'stripe_charge_id',
'stripe_intent',
'status',
];
protected $_label_fields = [
'ID','Purchase User ID','Sale User ID','Inventory ID','Order Date','Order Time','Subtotal','Tax','Discount','Total','Stripe Charge ID','xyzstripe_intent','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['purchase_user_id', 'Purchase User ID', 'required|integer'],
['sale_user_id', 'Sale User ID', 'required|integer'],
['inventory_id', 'Inventory ID', 'required|integer'],
['order_date', 'Order Date', 'required|date'],
['order_time', 'Order Time', 'required'],
['subtotal', 'Subtotal', 'required'],
['tax', 'Tax', 'required'],
['discount', 'Discount', 'required'],
['total', 'Total', 'required'],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['stripe_intent', 'xyzstripe_intent', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['purchase_user_id', 'Purchase User ID', 'required|integer'],
['sale_user_id', 'Sale User ID', 'required|integer'],
['inventory_id', 'Inventory ID', 'required|integer'],
['order_date', 'Order Date', ''],
['order_time', 'Order Time', 'required'],
['subtotal', 'Subtotal', 'required'],
['tax', 'Tax', 'required'],
['discount', 'Discount', 'required'],
['total', 'Total', 'required'],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['stripe_intent', 'xyzstripe_intent', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Paid',
2 => 'Refunded',
3 => 'Disputed',
4 => 'Canceled',
];
}
}
+89
View File
@@ -0,0 +1,89 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Order_notes_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Order_notes_model extends Manaknight_Model
{
protected $_table = 'order_notes';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'order_id',
'description',
];
protected $_label_fields = [
'ID','Order ID','Description',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['description', 'Description', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['description', 'Description', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+117
View File
@@ -0,0 +1,117 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Payout_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Payout_model extends Manaknight_Model
{
protected $_table = 'payout';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'order_id',
'inventory_id',
'name',
'email',
'amount',
'payout_date',
'status',
];
protected $_label_fields = [
'ID','User ID','Order ID','Order ID','Name','Email','Amount','Expected Payout Date','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['order_id', 'Order ID', 'required'],
['inventory_id', 'Order ID', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['amount', 'Amount', 'required'],
['payout_date', 'Expected Payout Date', 'required'],
['status', 'Status', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'User ID', 'required'],
['order_id', 'Order ID', 'required'],
['inventory_id', 'Order ID', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['amount', 'Amount', 'required'],
['payout_date', 'Expected Payout Date', 'required'],
['status', 'Status', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
3 => 'Refunded',
1 => 'Paid',
0 => 'Unpaid',
2 => 'Pending',
];
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Professor_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Professor_model extends Manaknight_Model
{
protected $_table = 'professor';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'status',
];
protected $_label_fields = [
'ID','Name','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+133
View File
@@ -0,0 +1,133 @@
<?php defined('BASEPATH') || exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Refer_log_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Refer_log_model extends Manaknight_Model
{
protected $_table = 'refer_log';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'referrer_user_id',
'type',
'status'
];
protected $_label_fields = [
'ID', 'Referree User', 'Referrer User', 'Type', 'Status'
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['user_id', 'Referree User', 'required|integer'],
['referrer_user_id', 'Referrer User', 'required|integer'],
['type', 'Type', 'required|integer'],
['status', 'Status', 'required|integer']
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['user_id', 'Referree User', ''],
['referrer_user_id', 'Referrer User', ''],
['type', 'Type', 'required|integer'],
['status', 'Status', '']
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['status'] = 0;
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping()
{
return [
0 => 'Pending',
1 => 'Confirmed',
2 => 'Paid'
];
}
public function type_mapping()
{
return [
0 => 'user'
];
}
public function get_user($where)
{
return $this->_join('user', 'user_id', $where, []);
}
public function get_user_paginated($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated($where)
{
return count($this->_join('user', 'user_id', $where, []));
}
public function get_referrer($where)
{
return $this->_join('referrer', 'referrer_user_id', $where, []);
}
public function get_referrer_paginated($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate('referrer', 'referrer_user_id', $where, $page, $limit, $order_by, $direction, []);
}
}
+110
View File
@@ -0,0 +1,110 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Refund_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Refund_model extends Manaknight_Model
{
protected $_table = 'refund';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'order_id',
'user_id',
'amount',
'reason',
'explanation',
'receipt_url',
'stripe_charge_id',
'stripe_invoice_id',
'status',
];
protected $_label_fields = [
'ID','Order ID','User ID','Amount','Reason','Explanation','Receipt URL','Stripe Charge ID','Stripe Invoice ID','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['user_id', 'User ID', ''],
['amount', 'Amount', ''],
['reason', 'Reason', ''],
['explanation', 'Explanation', ''],
['receipt_url', 'Receipt URL', ''],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['stripe_invoice_id', 'Stripe Invoice ID', ''],
['status', 'Status', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required'],
['user_id', 'User ID', ''],
['amount', 'Amount', ''],
['reason', 'Reason', ''],
['explanation', 'Explanation', ''],
['receipt_url', 'Receipt URL', ''],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['stripe_invoice_id', 'Stripe Invoice ID', ''],
['status', 'Status', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+117
View File
@@ -0,0 +1,117 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Review_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Review_model extends Manaknight_Model
{
protected $_table = 'review';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'inventory_id',
'order_id',
'status',
'comment',
'rating',
];
protected $_label_fields = [
'Id','User ID','Inventory ID','order_id','Status','Comment','Rating',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['inventory_id', 'Inventory ID', 'required|integer'],
['order_id', 'order_id', 'integer'],
['status', 'Status', 'required|integer'],
['comment', 'Comment', 'required'],
['rating', 'Rating', 'required'],
];
protected $_validation_edit_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['inventory_id', 'Inventory ID', 'required|integer'],
['order_id', 'order_id', 'integer'],
['status', 'Status', 'required|integer'],
['comment', 'Comment', 'required'],
['rating', 'Rating', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function rating_mapping ()
{
return [
1 => '1/10',
2 => '2/10',
3 => '3/10',
4 => '4/10',
5 => '5/10',
6 => '6/10',
7 => '7/10',
8 => '8/10',
9 => '9/10',
10 => '10/10',
];
}
}
+86
View File
@@ -0,0 +1,86 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Role_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Role_model extends Manaknight_Model
{
protected $_table = 'role';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
];
protected $_label_fields = [
'ID','Role Name',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Role Name', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Role Name', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+97
View File
@@ -0,0 +1,97 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* School_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class School_model extends Manaknight_Model
{
protected $_table = 'school';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'status',
];
protected $_label_fields = [
'ID','Name','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+126
View File
@@ -0,0 +1,126 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Setting_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Setting_model extends Manaknight_Model
{
protected $_table = 'setting';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'key',
'type',
'value',
];
protected $_label_fields = [
'ID','Setting Field','Setting Type','Setting Value',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['key', 'Setting Field', 'required'],
['type', 'Setting Type', 'required'],
['value', 'Setting Value', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['key', 'Setting Field', ''],
['type', 'Setting Type', ''],
['value', 'Setting Value', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
if(isset($data['key']))
{
unset($data['key']);
}
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function type_mapping ()
{
return [
0 => 'text',
1 => 'select',
2 => 'number',
3 => 'image',
4 => 'read_only',
];
}
public function maintenance_mapping ()
{
return [
0 => 'No',
1 => 'Yes',
];
}
public function get_config_settings()
{
$this->db->from('setting');
$results = $this->db->get()->result();
$data = [];
foreach ($results as $key => $value)
{
$data[$value->key] = $value->value;
}
return $data;
}
}
+122
View File
@@ -0,0 +1,122 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Sms_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Sms_model extends Manaknight_Model
{
protected $_table = 'sms';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'slug',
'tag',
'content',
];
protected $_label_fields = [
'ID','xyzSMS Slug','Replacement Tags','SMS Body',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['slug', 'xyzSMS Slug', 'required|is_unique[sms.slug]'],
['tag', 'Replacement Tags', 'required'],
['content', 'SMS Body', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['slug', 'xyzSMS Slug', ''],
['tag', 'Replacement Tags', ''],
['content', 'SMS Body', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
if(isset($data['slug']))
{
unset($data['slug']);
}
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function get_template($slug,$data)
{
$this->db->from('sms');
$this->db->where('slug',$slug,TRUE);
$template=$this->db->get()->row();
if(!$template)
{
return FALSE;
}
$tags_raw=$template->tags;
$tags=explode(',',$tags_raw);
$template->content=$this->inject_substitute($template->content,$tags,$data);
return $template;
}
public function inject_substitute($raw, $tags, $data)
{
foreach ($data as $key => $value)
{
if (in_array($key, $tags))
{
$raw = str_replace('{{{' . $key . '}}}', $value, $raw);
}
}
return $raw;
}
}
+104
View File
@@ -0,0 +1,104 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Spreadsheet_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Spreadsheet_model extends Manaknight_Model
{
protected $_table = 'spreadsheet';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'value',
'user_id',
'status',
];
protected $_label_fields = [
'ID','Name','CSV File','User Id','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required|max_length[255]'],
['value', 'CSV File', ''],
['user_id', 'User Id', ''],
['status', 'Status', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required|max_length[255]'],
['value', 'CSV File', ''],
['user_id', 'User Id', ''],
['status', 'Status', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
0 => 'Inactive',
1 => 'Active',
2 => 'Private',
];
}
}
+119
View File
@@ -0,0 +1,119 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Suggestion_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Suggestion_model extends Manaknight_Model
{
protected $_table = 'suggestion';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'seller_id',
'name',
'email',
'suggestion_type',
'additional_notes',
'status',
];
protected $_label_fields = [
'ID','xyzseller_id','Name','Email','Suggestion Type','Message','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['seller_id', 'xyzseller_id', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['suggestion_type', 'Suggestion Type', 'required'],
['additional_notes', 'Message', ''],
['status', 'Status', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['seller_id', 'xyzseller_id', ''],
['name', 'Name', 'required'],
['email', 'Email', 'required'],
['suggestion_type', 'Suggestion Type', 'required'],
['additional_notes', 'Message', ''],
['status', 'Status', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function suggestion_type_mapping ()
{
return [
1 => 'School',
2 => 'Professor',
3 => 'Textbook',
4 => 'Class',
];
}
public function status_mapping ()
{
return [
1 => 'Approve',
0 => 'Decline',
];
}
}
+86
View File
@@ -0,0 +1,86 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Tax_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Tax_model extends Manaknight_Model
{
protected $_table = 'tax';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'tax_rate',
];
protected $_label_fields = [
'ID','Tax_rate',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['tax_rate', 'Tax_rate', 'required'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['tax_rate', 'Tax_rate', 'required'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+100
View File
@@ -0,0 +1,100 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Textbook_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Textbook_model extends Manaknight_Model
{
protected $_table = 'textbook';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'name',
'isbn',
'status',
];
protected $_label_fields = [
'ID','Name','ISBN','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['isbn', 'ISBN', ''],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['name', 'Name', 'required'],
['isbn', 'ISBN', ''],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+114
View File
@@ -0,0 +1,114 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Ticket_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Ticket_model extends Manaknight_Model
{
protected $_table = 'ticket';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'user_id',
'order_id',
'message',
'receive_status',
'status',
];
protected $_label_fields = [
'Id','User ID','Order ID','Reason','Admin Received','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['order_id', 'Order ID', 'required|integer'],
['message', 'Reason', 'required'],
['receive_status', 'Admin Received', 'required|integer'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'Id', ''],
['user_id', 'User ID', 'required|integer'],
['order_id', 'Order ID', 'required|integer'],
['message', 'Reason', 'required'],
['receive_status', 'Admin Received', 'required|integer'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function receive_status_mapping ()
{
return [
1 => 'Yes',
0 => 'No',
];
}
public function status_mapping ()
{
return [
1 => 'Resolved',
0 => 'Unsolved',
];
}
}
+185
View File
@@ -0,0 +1,185 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Token_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Token_model extends Manaknight_Model
{
protected $_table = 'token';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'token',
'data',
'type',
'user_id',
'ttl',
'issue_at',
'expire_at',
'status',
];
protected $_label_fields = [
'ID','xyzToken','Data','Token Type','xUser','Time To Live','Issue at','Expire at','Status',
];
protected $_use_timestamps = FALSE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['token', 'xyzToken', 'required'],
['data', 'Data', 'required'],
['type', 'Token Type', 'required|integer'],
['user_id', 'xUser', 'required|integer'],
['ttl', 'Time To Live', 'required|integer'],
['issue_at', 'Issue at', 'required'],
['expire_at', 'Expire at', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['token', 'xyzToken', 'required'],
['data', 'Data', 'required'],
['type', 'Token Type', 'required|integer'],
['user_id', 'xUser', 'required|integer'],
['ttl', 'Time To Live', 'required|integer'],
['issue_at', 'Issue at', 'required'],
['expire_at', 'Expire at', 'required'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['status'] = 1;
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
0 => 'Inactive',
1 => 'Active',
];
}
public function type_mapping ()
{
return [
0 => 'Forgot_token',
1 => 'Access token',
2 => 'Refresh_token',
3 => 'Other',
4 => 'Api Key',
5 => 'Api Secret',
6 => 'Verify',
];
}
const NOT_FOUND = 0;
const EXPIRED = 1;
const FOUND = 2;
public function create_verify_token ($user_id, $phone)
{
$code = rand(100000,999999);
$expire_at = date('Y-m-j H:i:s', time() + 60 * 5);
$token = $this->create([
'token' => $code,
'data' => json_encode([
'code' => $code,
'phone' => $phone
]),
'type' => 6,
'user_id' => $user_id,
'ttl' => 5 * 60,
'issue_at' => date('Y-m-j H:i:s'),
'expire_at' => $expire_at,
'status' => 1
]);
return $code;
}
public function check_verify_token ($code)
{
$exist = $this->get_by_field('token', $code);
if (!$exist)
{
return NOT_FOUND;
}
$expire_at = strtotime($exist->expire_at);
if ($expire_at < time())
{
return EXPIRED;
}
return json_decode($exist->data, TRUE);
}
public function get_user ($where)
{
return $this->_join ('user', 'user_id', $where, []);
}
public function get_user_paginated ($page, $limit, $where, $order_by, $direction)
{
return $this->_join_paginate ('user', 'user_id', $where, $page, $limit, $order_by, $direction, []);
}
public function count_paginated ($where)
{
return count($this->_join ('user', 'user_id', $where, []));
}
}
+132
View File
@@ -0,0 +1,132 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Transaction_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Transaction_model extends Manaknight_Model
{
protected $_table = 'transaction';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'order_id',
'user_id',
'transaction_date',
'transaction_time',
'subtotal',
'tax',
'discount',
'total',
'stripe_charge_id',
'payment_method',
'status',
];
protected $_label_fields = [
'ID','Order ID','User ID','Transaction Date','Transaction Time','Subtotal','Tax','Discount','Total','Stripe Charge ID','Payment Method','Status',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required|integer'],
['user_id', 'User ID', 'required|integer'],
['transaction_date', 'Transaction Date', 'required|date'],
['transaction_time', 'Transaction Time', 'required'],
['subtotal', 'Subtotal', 'required'],
['tax', 'Tax', 'required'],
['discount', 'Discount', 'required'],
['total', 'Total', 'required'],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['payment_method', 'Payment Method', 'required|integer'],
['status', 'Status', 'required|integer'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['order_id', 'Order ID', 'required|integer'],
['user_id', 'User ID', 'required|integer'],
['transaction_date', 'Transaction Date', ''],
['transaction_time', 'Transaction Time', 'required'],
['subtotal', 'Subtotal', 'required'],
['tax', 'Tax', 'required'],
['discount', 'Discount', 'required'],
['total', 'Total', 'required'],
['stripe_charge_id', 'Stripe Charge ID', 'required'],
['payment_method', 'Payment Method', 'required|integer'],
['status', 'Status', 'required|integer'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function payment_method_mapping ()
{
return [
1 => 'Stripe',
2 => 'Paypal',
];
}
public function status_mapping ()
{
return [
1 => 'Active',
0 => 'Inactive',
];
}
}
+89
View File
@@ -0,0 +1,89 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* Url_redirect_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class Url_redirect_model extends Manaknight_Model
{
protected $_table = 'url_redirect';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'url',
'rewrite_url',
];
protected $_label_fields = [
'ID','URL','xyzRewrite URL',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['url', 'URL', 'required|max_length[255]'],
['rewrite_url', 'xyzRewrite URL', 'required|max_length[255]'],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['url', 'URL', 'required|max_length[255]'],
['rewrite_url', 'xyzRewrite URL', 'required|max_length[255]'],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
}
+112
View File
@@ -0,0 +1,112 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User_card_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class User_card_model extends Manaknight_Model
{
protected $_table = 'user_card';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'is_default',
'user_id',
'stripe_card_id',
'last4',
'brand',
'exp_month',
'exp_year',
];
protected $_label_fields = [
'ID','Is Default','User ID','Stripe Card ID','Last4','Brand','Expire month','Expire year',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['is_default', 'Is Default', 'required|integer'],
['user_id', 'User ID', ''],
['stripe_card_id', 'Stripe Card ID', ''],
['last4', 'Last4', ''],
['brand', 'Brand', ''],
['exp_month', 'Expire month', ''],
['exp_year', 'Expire year', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['is_default', 'Is Default', 'required|integer'],
['user_id', 'User ID', ''],
['stripe_card_id', 'Stripe Card ID', ''],
['last4', 'Last4', ''],
['brand', 'Brand', ''],
['exp_month', 'Expire month', ''],
['exp_year', 'Expire year', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function is_default_mapping ()
{
return [
0 => 'No',
1 => 'Yes',
];
}
}
+144
View File
@@ -0,0 +1,144 @@
<?php defined('BASEPATH') OR exit('No direct script access allowed');
/*Powered By: Manaknightdigital Inc. https://manaknightdigital.com/ Year: 2021*/
/**
* User_model Model
* @copyright 2019 Manaknightdigital Inc.
* @link https://manaknightdigital.com
* @license Proprietary Software licensing
* @author Ryan Wong
*
*/
class User_model extends Manaknight_Model
{
protected $_table = 'user';
protected $_primary_key = 'id';
protected $_return_type = 'array';
protected $_allowed_fields = [
'id',
'first_name',
'last_name',
'paypal_email',
'phone',
'image',
'image_id',
'refer',
'profile_id',
'stripe_id',
];
protected $_label_fields = [
'ID','First Name','Last Name','Email #','Phone #','Image','Image ID','Refer Code','Profile','Stripe Id',
];
protected $_use_timestamps = TRUE;
protected $_created_field = 'created_at';
protected $_updated_field = 'updated_at';
protected $_validation_rules = [
['id', 'ID', ''],
['first_name', 'First Name', ''],
['last_name', 'Last Name', ''],
['paypal_email', 'Email #', ''],
['phone', 'Phone #', ''],
['image', 'Image', ''],
['image_id', 'Image ID', ''],
['refer', 'Refer Code', ''],
['profile_id', 'Profile', ''],
['stripe_id', 'Stripe Id', ''],
];
protected $_validation_edit_rules = [
['id', 'ID', ''],
['first_name', 'First Name', ''],
['last_name', 'Last Name', ''],
['paypal_email', 'Email #', ''],
['phone', 'Phone #', ''],
['image', 'Image', ''],
['image_id', 'Image ID', ''],
['refer', 'Refer Code', ''],
['profile_id', 'Profile', ''],
['stripe_id', 'Stripe Id', ''],
];
protected $_validation_messages = [
];
public function __construct()
{
parent::__construct();
}
/**
* If you need to modify payload before create, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _pre_create_processing($data)
{
$data['image'] = 'https://i.imgur.com/AzJ7DRw.png';
$data['refer'] = uniqid();
$data['status'] = 1;
$data['verify'] = 0;
$data['stripe_id'] = '';
if(!isset($data['profile_id']))
{
$data['profile_id'] = 0;
}
if(!isset($data['type']))
{
$data['type'] = 'n';
}
if (strpos($data['phone'], '1') != 0)
{
$data['phone'] = '1' + $data['phone'];
}
return $data;
}
/**
* If you need to modify payload before edit, overload this function
*
* @param mixed $data
* @return mixed
*/
protected function _post_edit_processing($data)
{
if(isset($data['image']) && strlen($data['image']) < 1)
{
unset($data['image']);
}
return $data;
}
/**
* Allow user to add extra counting condition so user don't have to change main function
*
* @param mixed $parameters
* @return $db
*/
protected function _custom_counting_conditions(&$db)
{
return $db;
}
public function status_mapping ()
{
return [
0 => 'Inactive',
1 => 'Active',
2 => 'Suspend',
];
}
}
+11
View File
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>
<p>Directory access is forbidden.</p>
</body>
</html>