<commit_before><?php

namespace Dwij\Laraadmin\Helpers;

use DB;
use Log;

use Dwij\Laraadmin\Models\Module;

class LAHelper
{
	// $names = LAHelper::generateModuleNames($module_name);
    public static function generateModuleNames($module_name, $icon) {
		$array = array();
		$module_name = trim($module_name);
		$module_name = str_replace(" ", "_", $module_name);
		
		$array['module'] = ucfirst(str_plural($module_name));
		$array['label'] = ucfirst(str_plural($module_name));
		$array['table'] = strtolower(str_plural($module_name));
		$array['model'] = ucfirst(str_singular($module_name));
		$array['fa_icon'] = $icon;
		$array['controller'] = $array['module']."Controller";
		$array['singular_l'] = strtolower(str_singular($module_name));
		$array['singular_c'] = ucfirst(str_singular($module_name));
		
		return (object) $array;
	}
	
	// $tables = LAHelper::getDBTables([]);
    public static function getDBTables($remove_tables = []) {
        if(env('DB_CONNECTION') == "sqlite") {
			$tables_sqlite = DB::select('select * from sqlite_master where type="table"');
			$tables = array();
			foreach ($tables_sqlite as $table) {
				if($table->tbl_name != 'sqlite_sequence') {
					$tables[] = $table->tbl_name;
				}
			}
		} else {
			$tables = DB::select('SHOW TABLES');<commit_msg>show tables - conditional for pgsql<commit_after><?php

namespace Dwij\Laraadmin\Helpers;

use DB;
use Log;

use Dwij\Laraadmin\Models\Module;

class LAHelper
{
	// $names = LAHelper::generateModuleNames($module_name);
    public static function generateModuleNames($module_name, $icon) {
		$array = array();
		$module_name = trim($module_name);
		$module_name = str_replace(" ", "_", $module_name);
		
		$array['module'] = ucfirst(str_plural($module_name));
		$array['label'] = ucfirst(str_plural($module_name));
		$array['table'] = strtolower(str_plural($module_name));
		$array['model'] = ucfirst(str_singular($module_name));
		$array['fa_icon'] = $icon;
		$array['controller'] = $array['module']."Controller";
		$array['singular_l'] = strtolower(str_singular($module_name));
		$array['singular_c'] = ucfirst(str_singular($module_name));
		
		return (object) $array;
	}
	
	// $tables = LAHelper::getDBTables([]);
    public static function getDBTables($remove_tables = []) {
        if(env('DB_CONNECTION') == "sqlite") {
			$tables_sqlite = DB::select('select * from sqlite_master where type="table"');
			$tables = array();
			foreach ($tables_sqlite as $table) {
				if($table->tbl_name != 'sqlite_sequence') {
					$tables[] = $table->tbl_name;
				}
			}
		} else if(env('DB_CONNECTION') == "pgsql") {
			$tables_pgsql = DB::select("SELECT table_name FROM information_schema.tables WHERE table_type = 'BASE TABLE' AND table_schema = 'public' ORDER BY table_name;");
			$tables = array();
			foreach ($tables_pgsql as $table) {
				$tables[] = $table->table_name;
			}
		} else if(env('DB_CONNECTION') == "mysql") {
			$tables = DB::select('SHOW TABLES');
		} else {
			$tables = DB::select('SHOW TABLES');
{'fraction_non_alphanumeric': 0.1810918774966711, 'fraction_numerical': 0.0, 'mean_word_length': 5.157786885245901, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7524187', 'n_tokens_mistral': 1131, 'n_tokens_neox': 1015, 'n_words': 179}