golf_backend/app/Controllers/Common_controller.php
suseendhiran17 60ca21e866 susee
2023-06-10 10:19:16 +05:30

141 lines
1.6 KiB
PHP

<?php
namespace App\Controllers;
use App\Models\User_model;
use App\Models\Dashboard_model;
use App\Models\Common_model;
use App\Models\Member_model;
class Common_controller extends BaseController
{
public $session;
public function __construct()
{
$this->session = session();
$this->MemberModel = new Member_model();
$this->UserModel = new User_model();
$this->dModel = new Dashboard_model();
$this->cModel = new Common_model();
helper(['form']);
}
public function index()
{
}
function fetch_country()
{
echo $this->cModel->fetch_country();
}
function fetch_state()
{
if($this->request->getVar('country_id'))
{
echo $this->cModel->fetch_state($this->request->getVar('country_id'));
}
}
function fetch_city()
{
if($this->request->getVar('state_id'))
{
echo $this->cModel->fetch_city($this->request->getVar('state_id'));
}
}
function check_if_mail_exists()
{
if($this->request->getVar('table'))
{
if($this->request->getVar('table') == 'member')
$data = $this->MemberModel->where('email', $this->request->getVar('email'))->where('is_active', 1)->find();
else if($this->request->getVar('table') == 'users')
$data = $this->UserModel->where('email', $this->request->getVar('email'))->where('is_active', 1)->find();
if ($data)
{
echo true;
}
else
{
echo false;
}
}
}
// -----------------------------------------------
}