update
This commit is contained in:
39
inc/Hura8/System/Model/UtilityModel.php
Normal file
39
inc/Hura8/System/Model/UtilityModel.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?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');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user