Files

40 lines
881 B
PHP
Raw Permalink Normal View History

2024-01-29 10:39:53 +07:00
<?php
namespace Hura8\System\Model;
use Hura8\Database\iConnectDB;
use Hura8\Interfaces\AppResponse;
/**
* @date 21-Dec-2023
* @description various utility for management and setup
*/
class UtilityModel
{
protected $db;
protected $tb_entity_lang_template = "tb_entity_lang_template";
public function __construct($db_id = '') {
$this->db = get_db($db_id, ENABLE_DB_DEBUG);
}
public function createTableLang($tb_entity_lang): AppResponse {
$result = $this->db->checkTableExist($tb_entity_lang);
// check if table exist
if(!$result) {
$this->db->runQuery("CREATE TABLE `".$tb_entity_lang."` LIKE `".$this->tb_entity_lang_template."` ");
// recheck
$result = $this->db->checkTableExist($tb_entity_lang);
}
return new AppResponse($result ? 'ok': 'error');
}
}