<?php

use app\libraries\TenantHelper;

defined('BASEPATH') or exit('No direct script access allowed');

class Tenant_switch extends MY_BackendController
{
    public function index()
    {
        $this->load->model('System_admin_landing_tenant_model');

        $tenantNo = $this->input->post('tenant_no');
        $username = $this->session->userdata('username');
        $this->System_admin_landing_tenant_model->update_tenant_switch($tenantNo, $username);
        TenantHelper::setTenant($tenantNo);

        return redirect($_SERVER['HTTP_REFERER']);
    }
}
