From b3e8035119e1916d55e1311f01408e15112dc5a7 Mon Sep 17 00:00:00 2001 From: Ranjan Date: Thu, 4 Apr 2024 13:25:46 +0545 Subject: [PATCH] helpers --- app/Helpers/.DS_Store | Bin 0 -> 6148 bytes app/Helpers/BibClass.php | 194 +++++++++ app/Helpers/OMIS.php | 764 ++++++++++++++++++++++++++++++++++++ app/Helpers/bibHelper.php | 799 ++++++++++++++++++++++++++++++++++++++ 4 files changed, 1757 insertions(+) create mode 100644 app/Helpers/.DS_Store create mode 100644 app/Helpers/BibClass.php create mode 100644 app/Helpers/OMIS.php create mode 100644 app/Helpers/bibHelper.php diff --git a/app/Helpers/.DS_Store b/app/Helpers/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5c7ecadd95a875f936bd2b1f2d67d8d51146d8d8 GIT binary patch literal 6148 zcmeHK%Sr=55Ukc57L1Ui7h%32;2*4O1alA%`2k%O6c(~Xyzd|RiCX9bGK;2AA0 z@csFp&@a37ecP>D=BPmDZ1Z-Jfm9$B_)CtG;u1?sS+iIIGz0^^6J3B(dm#VJ|tHDEMCM`=lsReA+=-rR3H`DRzPcC+Dy;? zOMWt=MZTq^O9fJa|EhpY7OO?Ww~MoN?>+UbEo`@JYMM7_Kx4dh3E&^yM^0?e$BV|y Ys{;o|okjbNPRxsd36d@q_yq+%0FIS58UO$Q literal 0 HcmV?d00001 diff --git a/app/Helpers/BibClass.php b/app/Helpers/BibClass.php new file mode 100644 index 0000000..13feb08 --- /dev/null +++ b/app/Helpers/BibClass.php @@ -0,0 +1,194 @@ + + + + +

+ $field; + } else { + return "Not Found in Table"; + } + } + static function getRow($tableName, $condition = "1") + { + $tableName = strtolower($tableName); + $t = "select * from $tableName where $condition"; + $Value = DB::select($t); + return (empty($Value) ? "Not Found" : $Value[0]); + } + static function getRowByQuery($query) + { + $Value = DB::select($query); + return (empty($Value) ? false : $Value[0]); + } + static function getTableByQuery($query) + { + $Value = DB::select($query); + + return (empty($Value) ? false : $Value); + } + static function updateRow($tableName, $fieldName, $fieldValue, $referenceField, $referenceValue) + { + $tableName = strtolower($tableName); + $t = "update $tableName set $fieldName='$fieldValue' where $referenceField=$referenceValue"; + return DB::select($t); + } + public static function pre($array) + { + echo "
";
+        print_r($array);
+        echo "
"; + } + public static function addButton($path, $text) + { + ?> + + + + +
  • +
  • +
  • + "; + BibClass::addButton("edit/$pk", 'Edit'); + BibClass::addButton("view/$pk", 'View'); + BibClass::addButton("destroy/$pk", 'Delete'); + } + + public static function getController() + { + $routeArray = app('request')->route()->getAction(); + $controllerAction = class_basename($routeArray['controller']); + list($controller, $action) = explode('@', $controllerAction); + + print_r($controller); + } + public static function createSidebarMenu($link, $name, $target = "") + { + ?> +
  • >
  • + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +
    $TableCol; ?> +
    + +Field; + switch ($tableField) { + case $Table_pk: + case 'status': + case 'created_at': + case 'updated_at': + break; + default: + createInput("text", $tableField, $tableField, $tableField, "", "", ""); + } + } + } +} diff --git a/app/Helpers/OMIS.php b/app/Helpers/OMIS.php new file mode 100644 index 0000000..5d980be --- /dev/null +++ b/app/Helpers/OMIS.php @@ -0,0 +1,764 @@ +initDB(); + // $this->seedPermissions(); + // } + + public static function sendSMSWithCurl($destination, $message) + { + $userName = (SITEVARS->sms_username) ? SITEVARS->sms_username : ''; + $password = (SITEVARS->sms_password) ? SITEVARS->sms_password : ''; + $sender = (SITEVARS->sms_sender) ? SITEVARS->sms_sender : ''; + $url = (SITEVARS->sms_api) ? SITEVARS->sms_api : 'http://api.ininepal.com/api/index?'; + $encodedMessage = urlencode($message); + $encodedDestination = urlencode($destination); + $url_query = "username={$userName}&password={$password}&msg={$encodedMessage}&contacts={$encodedDestination}&responsetype=json"; + $url_final = $url . $url_query; + + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url_final); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); + + $response = curl_exec($ch); + ob_clean(); + if ($response === false) { + // Handle the error if needed (e.g., log the error) + return false; + } + + // Close the cURL session + curl_close($ch); + return true; + } + + //CONSULTANCY RELATED TEMP FUNCTIONS + public static function createMenuLink($text, $URL) + { + $isActive = request()->fullUrl() == $URL; + $activeClass = $isActive ? 'active' : ''; + ?> +
  • + + + +
  • +where('status', 1)->orderby('display_order')->first(); + + return $siteVars; + } + + public static function showForm($formID) + { + if (is_numeric($formID)) { + $Form = DB::table("forms")->where('form_id', $formID)->first(); + } else { + $Form = DB::table("forms")->where('alias', $formID)->first(); + } + if (!$Form) { + // Handle the case where the form with the given ID/alias doesn't exist + return "Error: Form (ID/Alias: $formID) not found."; + } + $csrfToken = csrf_token(); + if (session('success')) { + echo ''; + } + echo '
    '; + echo ''; + echo ''; + $form_fields = json_decode($Form->form_fields); + foreach ($form_fields as $field) { + $fieldAlias = strtolower($field->fieldAlias); + $fieldName = strtolower($field->fieldName); + $fieldType = $field->fieldType; + $fieldDefault = $field->fieldDefault; + $fieldCss = $field->fieldCss; + echo '
    '; + echo ''; + // Check if the "required" class is present in $fieldCss and add the required attribute + $isRequired = strpos($fieldCss, 'required') !== false; + if ($fieldType === 'textarea') { + echo ''; + } else { + echo ''; + } + echo '
    '; + } + echo ''; + echo '
    '; + } + + public static function seedPermissions() + { + $modelNames = self::getModelNames(); + + foreach ($modelNames as $modelName) { + self::createPermission($modelName, 'create'); + self::createPermission($modelName, 'edit'); + self::createPermission($modelName, 'index'); + self::createPermission($modelName, 'delete'); + self::createPermission($modelName, 'store'); + self::createPermission($modelName, 'update'); + } + } + + public static function getModelNames() + { + // Adjust the directory path based on your model location + $modelsDirectory = app_path('Models'); + $files = scandir($modelsDirectory); + $models = []; + + foreach ($files as $file) { + if (pathinfo($file, PATHINFO_EXTENSION) == 'php') { + $modelName = pathinfo($file, PATHINFO_FILENAME); + $models[] = $modelName; + } + } + + return $models; + } + public static function createPermission($modelName, $command) + { + + $AdminUser = DB::table('users') + ->where('roles_id', 1) + ->first(); + if (!$AdminUser) { + // dd("hello"); + DB::table('users')->insert([ + 'name' => 'Prajwal Adhikari', + 'email' => 'prajwalbro@hotmail.com', + 'username' => 'prajwalbro@hotmail.com', + 'password' => Hash::make('p@ssw0rd'), + 'roles_id' => 1, + 'created_at' => now(), // or use a specific timestamp if needed + 'createdby' => 1, // replace with the actual user ID who created it + 'updated_at' => now(), + 'updatedby' => 1, // replace with the actual user ID who updated it + 'status' => 1, // adjust as needed + ]); + } + $permissionName = "{$command} {$modelName}"; + $existingPermission = DB::table('permissions') + ->where('title', $permissionName) + ->first(); + $adminRole = DB::table('roles') + ->where('title', 'admin') + ->first(); + if (!$existingPermission) { + $LastInsertID = DB::table('permissions')->insert([ + 'title' => ucfirst($command) . ' ' . $modelName, + 'alias' => strtolower("{$command}_{$modelName}"), + 'modal' => $modelName, + 'command' => $command, + 'created_at' => now(), // or use a specific timestamp if needed + 'createdby' => 1, // replace with the actual user ID who created it + 'updated_at' => now(), + 'updatedby' => 1, // replace with the actual user ID who updated it + 'status' => 1, // adjust as needed + ]); + DB::table('rolepermissions')->insert([ + 'roles_id' => $adminRole->role_id, + 'permissions_id' => $LastInsertID, + 'created_at' => now(), + 'createdby' => 1, + 'updated_at' => now(), + 'updatedby' => 1, + 'status' => 1, + + ]); + } + } + private function initDB() + { + static $initialized = false; + if (!$initialized) { + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_operation_logs` ( + `operation_id` bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `refNo` varchar(255) DEFAULT NULL, + `user_id` int(11) DEFAULT NULL, + `operation_start_no` bigint(20) DEFAULT NULL, + `operation_end_no` bigint(20) DEFAULT NULL, + `model_name` varchar(100) DEFAULT NULL, + `model_id` int(11) DEFAULT NULL, + `operation_name` varchar(100) DEFAULT NULL, + `previous_values` text DEFAULT NULL, + `new_values` longtext DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_error_logs` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `user_id` bigint(20) UNSIGNED DEFAULT NULL, + `controller_name` varchar(255) DEFAULT NULL, + `method_name` varchar(255) DEFAULT NULL, + `errors` longTEXT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_activity_logs` ( + `activity_id` bigint(20) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `user_id` int(11) DEFAULT NULL, + `controllerName` varchar(100) DEFAULT NULL, + `methodName` varchar(100) DEFAULT NULL, + `actionUrl` varchar(255) DEFAULT NULL, + `activity` varchar(255) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_users` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, + `name` varchar(255) NULL, + `email` varchar(255) NULL, + `username` varchar(255) NULL, + `email_verified_at` timestamp NULL DEFAULT NULL, + `password` varchar(255) NULL, + `remember_token` varchar(100) DEFAULT NULL, + `display_order` INT(11) DEFAULT 1, + `roles_id` INT(11), + `branches_id` INT(11), + `vendors_id` INT(11), + `employees_id` INT(11), + `status` INT(11) DEFAULT 1, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` INT(11), + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS tbl_roles ( + role_id INT(11) AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255), + alias VARCHAR(255), + description TEXT, + display_order INT(11), + status INT(11), + remarks TEXT, + created_at DATETIME, + createdby INT(11), + updated_at DATETIME, + updatedby INT(11) + );"); + DB::statement("CREATE TABLE IF NOT EXISTS tbl_permissions ( + permission_id INT(11) AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255), + alias VARCHAR(255), + modal VARCHAR(255), + command VARCHAR(255), + created_at DATETIME, + createdby INT(11), + updated_at DATETIME, + updatedby INT(11), + status INT(11) + + );"); + DB::statement("CREATE TABLE IF NOT EXISTS tbl_rolepermissions ( + rolepermission_id INT(11) AUTO_INCREMENT PRIMARY KEY, + roles_id INT(11), + permissions_id INT(11), + display_order INT(11), + remarks VARCHAR(255), + created_at DATETIME, + createdby INT(11), + updated_at DATETIME, + updatedby INT(11), + status INT(11) + );"); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_settings` ( + `setting_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) NULL, + `description` TEXT NULL, + `url1` varchar(255) NULL, + `url2` varchar(255) NULL, + `email` varchar(255) NULL, + `phone` varchar(255) NULL, + `secondary_phone` varchar(255) NULL, + `google_map` TEXT NULL, + `fb` varchar(255) NULL, + `insta` varchar(255) NULL, + `twitter` varchar(255) NULL, + `tiktok` varchar(255) NULL, + `primary_logo` varchar(255) NULL, + `secondary_logo` varchar(255) NULL, + `thumb` varchar(255) NULL, + `icon` varchar(255) NULL, + `og_image` varchar(255) NULL, + `no_image` varchar(250) NULL, + `copyright_text` varchar(250) NULL, + `content1` TEXT NULL, + `content2` TEXT NULL, + `content3` TEXT NULL, + `seo_title` varchar(255) NULL, + `seo_description` TEXT NULL, + `seo_keywords` TEXT NULL, + `og_tags` TEXT NULL, + `display_order` int(11) NULL DEFAULT 0, + `status` int(11) NULL DEFAULT 0, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS tbl_progressstatuses ( + status_id INT(11) AUTO_INCREMENT PRIMARY KEY, + title VARCHAR(255), + alias VARCHAR(255), + display_order int(11), + created_at DATETIME, + createdby INT(11), + updated_at DATETIME, + updatedby INT(11), + status INT(11) + + );"); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_articles` ( + `article_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `parent_article` int(11) DEFAULT 0, + `title` varchar(250) NULL, + `alias` varchar(250) NULL, + `text` TEXT NULL, + `cover_photo` varchar(500) NOT NULL, + `thumb` varchar(255) NULL, + `display_order` int(11) NULL DEFAULT 0, + `status` int(11) NULL DEFAULT 0, + `created_at` timestamp NULL DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_countries` ( + `country_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME, + `createdby` INT(11), + `updated_at` DATETIME, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_proviences` ( + `provience_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `countries_id` INT(11) NULL, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME, + `createdby` INT(11), + `updated_at` DATETIME, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_districts` ( + `district_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `proviences_id` INT(11), + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT NOW(), + `createdby` INT(11), + `updated_at` DATETIME DEFAULT NOW(), + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_cities` ( + `city_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `districts_id` INT(11), + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT NOW(), + `createdby` INT(11), + `updated_at` DATETIME DEFAULT NOW(), + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_companytypes` ( + `companytype_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP, + `createdby` INT(11), + `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_companies` ( + `company_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `address` TEXT, + `cities_id` INT(11), + `companytypes_id` INT(11), + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT CURRENT_TIMESTAMP, + `createdby` INT(11), + `updated_at` DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_branches` ( + `branch_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `companies_id` INT(11) NULL, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `email` VARCHAR(255), + `telephone` VARCHAR(255), + `phone1` VARCHAR(255), + `phone2` VARCHAR(255), + `address` VARCHAR(255), + `company_reg` VARCHAR(255), + `company_pan` VARCHAR(255), + `logo` VARCHAR(255), + `is_main` INT(11) NULL Default 1, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME, + `createdby` INT(11), + `updated_at` DATETIME, + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_vendortypes` ( + `vendortypes_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT NOW(), + `createdby` INT(11), + `updated_at` DATETIME DEFAULT NOW(), + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_vendors` ( + `vendor_id` INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `vendortypes_id` INT(11) NULL, + `title` VARCHAR(255), + `alias` VARCHAR(255), + `description` TEXT, + `display_order` INT(11), + `status` INT(11), + `remarks` TEXT, + `created_at` DATETIME DEFAULT NOW(), + `createdby` INT(11), + `updated_at` DATETIME DEFAULT NOW(), + `updatedby` INT(11) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + "); + + DB::statement("CREATE TABLE IF NOT EXISTS `tbl_genders` ( + `gender_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_castes` ( + `caste_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_ethnicities` ( + `ethnicity_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_dags` ( + `dag_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_nationalities` ( + `nationality_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; +"); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_employees` ( + `employee_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `first_name` varchar(255) DEFAULT NULL, + `middle_name` varchar(255) DEFAULT NULL, + `last_name` varchar(255) DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + `genders_id` int(11) DEFAULT NULL, + `nepali_dob` date DEFAULT NULL, + `dob` date DEFAULT NULL, + `nationalities_id` int(11) DEFAULT NULL, + `about_me` text, + `signature` varchar(255) DEFAULT NULL, + `father_name` varchar(255) DEFAULT NULL, + `mother_name` varchar(255) DEFAULT NULL, + `grand_father_name` varchar(255) DEFAULT NULL, + `grand_mother_name` varchar(255) DEFAULT NULL, + `spouse` varchar(255) DEFAULT NULL, + `contact` varchar(255) DEFAULT NULL, + `alt_contact` varchar(255) DEFAULT NULL, + `profile_picture` varchar(255) DEFAULT NULL, + `users_id` int(11) DEFAULT NULL, + `is_login_required` tinyint(1) DEFAULT NULL, + `skills` text, + `experience` text, + `permanent_address` text, + `permanent_city` int(11) DEFAULT NULL, + `temporary_address` text, + `temporary_city` int(11) DEFAULT NULL, + `old_system_address` text, + `education` text, + `castes_id` int(11) DEFAULT NULL, + `ethnicities_id` int(11) DEFAULT NULL, + `dags_id` int(11) DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` varchar(255) DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL, + `remarks` varchar(255) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_onboardings` ( + `onboarding_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `doj` datetime DEFAULT NULL, + `designations_id` int(11) DEFAULT NULL, + `position_status` varchar(255) DEFAULT NULL, + `departments_id` int(11) DEFAULT NULL, + `shifts_id` int(11) DEFAULT NULL, + `agreement` varchar(255) DEFAULT NULL, + `nda` varchar(255) DEFAULT NULL, + `terms` text DEFAULT NULL, + `workoptions` varchar(255) DEFAULT NULL, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + // Dharamaraj + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_departments` ( + `department_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL, + `branches_id` int(11) DEFAULT NULL, + `description` text DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_designations` ( + `designation_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL, + `job_description` text DEFAULT NULL, + `departments_id` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_shifts` ( + `shift_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_workoptions` ( + `workoption_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_leavetypes` ( + `leavetype_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + DB::statement(" + CREATE TABLE IF NOT EXISTS `tbl_leaves` ( + `leave_id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, + `title` varchar(255) DEFAULT NULL, + `alias` varchar(255) DEFAULT NULL, + `status` int(11) DEFAULT NULL, + `remarks` text DEFAULT NULL, + `display_order` int(11) DEFAULT NULL, + `created_at` timestamp NULL DEFAULT NULL, + `createdby` int(11) DEFAULT NULL, + `updated_at` timestamp NULL DEFAULT NULL, + `updatedby` int(11) DEFAULT NULL, + `leavetypes_id` int(11) DEFAULT NULL + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + "); + + if (!(DB::table('users')->first())) { + DB::statement("INSERT INTO `tbl_users` (`name`,`email`,`username`,`password`,`roles_id`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1','1');"); + } + if (!(DB::table('settings')->first())) { + DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) VALUES ('Bibhuti OMIS', '', '1');"); + } + + if (!(DB::table('countries')->first())) { + DB::statement("INSERT INTO `tbl_countries` (`title`,`alias`,`status`) VALUES ('Nepal','nepal', '1');"); + } + if (!(DB::table('proviences')->first())) { + DB::statement("INSERT INTO `tbl_proviences` (`title`,`alias`,`status`) VALUES ('Bagmati','bagmati', '1');"); + } + + if (!(DB::table('roles')->first())) { + DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Admin','admin','1');"); + DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Manager','manager','1');"); + DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Branch','branch','1');"); + DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Agent','agent','1');"); + DB::statement("INSERT INTO `tbl_roles` (`title`,`alias`,`status`) VALUES ('Student','student','1');"); + } + + $initialized = true; + } + } +} diff --git a/app/Helpers/bibHelper.php b/app/Helpers/bibHelper.php new file mode 100644 index 0000000..4c6c757 --- /dev/null +++ b/app/Helpers/bibHelper.php @@ -0,0 +1,799 @@ +"; + print_r($object); + echo ""; + if ($die) + die; +} +function label($text, $echo = true) +{ + + $text = strtoupper($text); + if ($echo) { + echo $text; + } else { + return $text; + } +} +function template($filepath) +{ + $filepath = env("APP_URL") . '/' . env("CLIENT_PATH") . '/' . $filepath; + // $filepath=str_replace('\\','/',env("APP_URL")."/layout/".$filepath); + echo $filepath; + // return +} +function landingtemplate($filepath) +{ + $filepath = env("APP_URL") . '/' . env("CLIENT_PATH") . '/landing/' . $filepath; + // $filepath=str_replace('\\','/',env("APP_URL")."/layout/".$filepath); + echo $filepath; + // return +} +if (!function_exists('N2')) { + function N2($N) + { + return number_format($N, 2, '.', ','); + } +} +if (!function_exists('slugify')) { + function slugify($text, $tableName = null) + { + // Generate the initial slug from the text + $slug = preg_replace('/[^a-zA-Z0-9\-]/', '-', $text); + $slug = preg_replace('/-+/', '-', $slug); + $slug = trim($slug, '-'); + $slug = strtolower($slug); + + // If the table name is provided, check for uniqueness and modify the slug if needed + if ($tableName) { + $originalSlug = $slug; + $count = 1; + + while (isSlugExists($tableName, $slug)) { + $slug = $originalSlug . '-' . $count; + $count++; + } + } + + return $slug; + } +} +if (!function_exists('isSlugExists')) { + function isSlugExists($tableName, $slug) + { + $aliasField = 'alias'; + $count = DB::table($tableName) + ->where($aliasField, $slug) + ->count(); + return $count > 0; + } +} + +function createButton($class = "", $type = "submit", $display = "Submit", $url = "") +{ + if (!$url): + ?> + + + + + + + + +
    + placeholder="" + name="" class="form-control " value="" required> +
    +

    + where('status', '<>', -1)->orderBy($pk, 'asc')->pluck($name, $pk); + $customColumnName = !empty($customColumnName) ? $customColumnName : $pk; //if we pass column name other then primary key. + customCreateSelect($pk, $pk, $class, $display ?? $name, $systems, ($data) ? $data->$customColumnName : null); +} +function customCreateSelect($name, $id, $class = "form-control", $display = '', $values = array(), $defaultValue = '') +{ + $disabled = (in_array("DISABLED", explode(" ", strtoupper($class)))) ? "Disabled" : false; + $required = (in_array("REQUIRED", explode(" ", strtoupper($class)))) ? "Required" : false; + ?> + + + + +

    + + + + + + +

    + where('status', '<>', -1); + + if ($defaultCondition) { + $query->whereRaw($defaultCondition); + } + + $systems = $query->orderBy($fieldNameForValue, 'asc')->pluck($fieldNameToDisplay, $fieldNameForValue); + + ?> + + + +

    + +
    + + + + + + + value="" + multiple> +
    +
    + " style="height: 5rem" /> + +
    + + + +
    + + + + + + + value="" + multiple> +
    +
    + " style="height: 5rem" /> + +
    + + + +
    + " style="height: 40px;" + class="img-fluid" /> + +
    + where($referenceFieldName, $referenceValue); + + $fieldData = ($query->value($returnField)) ? $query->value($returnField) : "N/A"; + + return $fieldData; +} + + +function createErrorParagraph($name, $class = null) +{ + echo "

    "; +} +function createActivityLog($controllerName, $methodName, $activity) +{ + $user_id = (auth()->user()) ? auth()->user()->id : "0"; + ActivityLog::create([ + 'user_id' => $user_id, + 'controllerName' => $controllerName, + 'methodName' => $methodName, + 'actionUrl' => request()->fullUrl(), + 'activity' => $activity, + ]); +} +function getOperationNumber() +{ + $startNumber = date('YmdHis') . rand(1000, 9999); + $isExists = OperationLog::where('operation_end_no', $startNumber)->first(); + while ($isExists) { + $startNumber = date('YmdHis') . rand(1000, 9999); + $isExists = OperationLog::where('operation_end_no', $startNumber)->first(); + } + return $startNumber; +} + +function createOperationLog($startOperationNumber, $endOperationNumber, $modelName, $modelId, $operationName, $previousValues, $newValues) +{ + $operationId = getOperationNumber(); + $user_id = (auth()->user()) ? auth()->user()->id : "0"; + OperationLog::create([ + 'user_id' => $user_id, + 'operation_start_no' => $startOperationNumber, + 'operation_end_no' => $endOperationNumber, + 'model_name' => $modelName, + 'model_id' => $modelId, + 'operation_name' => $operationName, + 'previous_values' => $previousValues ? json_encode($previousValues) : null, + 'new_values' => $newValues ? json_encode($newValues) : null, + ]); +} +function createErrorLog($controllerName, $methodName, $errors) +{ + $user_id = (auth()->user()) ? auth()->user()->id : "0"; + ErrorLog::create([ + 'user_id' => $user_id, + 'controller_name' => $controllerName, + 'method_name' => $methodName, + 'errors' => $errors, + ]); +} +function createDate($name, $display = "", $class = "datepicker", $default = "") +{ + ?> + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + display_order; + $nextDisplayOrder = $maxDisplayOrder + 1; + return $nextDisplayOrder; +} +function getAlias($textField, $tableName) +{ + + $maxDisplayOrder = DB::select("select max(display_order) as display_order from $tableName")[0]->display_order; + $nextDisplayOrder = $maxDisplayOrder + 1; + return $nextDisplayOrder; +} +if (!function_exists('myDate')) { + function myDate($originalDate) + { + return date("F d Y", strtotime($originalDate)); + } +} + +if (!function_exists('dbDate')) { + function dbDate($date) + { + return date("Y-m-d", strtotime($date)); + } +} + +if (!function_exists('myTime')) { + function myTime($originalDate) + { + return date("g:i A", strtotime($originalDate)); + } +} + +if (!function_exists('myDateTime')) { + function myDateTime($originalDate) + { + return date("F d Y g:i A", strtotime($originalDate)); + } +} + +if (!function_exists('myDaysDiff')) { + function myDaysDiff($fromDate, $toDate) + { + $fromDate = strtotime($fromDate); + $toDate = strtotime($toDate); + $datediff = $toDate - $fromDate; + return round($datediff / (60 * 60 * 24)); + } +} + +if (!function_exists('firstDayOfNepaliMonth')) { + function firstDayOfNepaliMonth($engDate = "") + { + $engDate = ($engDate != "") ? $engDate : date("Y-m-d"); + $NepaliDate = NepaliDate($engDate); + $nD = explode("-", $NepaliDate); + $Day = '1'; + $Month = $nD[1]; + $Year = $nD[0]; + $t = "select bs_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'"; + return DB::select($t)[0]->bs_date; + } +} + +if (!function_exists('firstDayOfNepaliMonth1')) { + function firstDayOfNepaliMonth1($engDate = "") + { + $engDate = ($engDate != "") ? $engDate : date("Y-m-d"); + $NepaliDate = NepaliDate($engDate); + $nD = explode("-", $NepaliDate); + $Day = '1'; + $Month = ($nD[1] < 10) ? '0' . $nD[1] : $nD[1]; + $Year = $nD[0]; + $t = "select ad_date from tbl_nepengcalendar where bs_date='" . $Year . "-" . $Month . "-" . $Day . "'"; + return DB::select($t)[0]->ad_date; + } +} + +if (!function_exists('lastDayOfNepaliMonth')) { + function lastDayOfNepaliMonth($engDate = "") + { + $engDate = ($engDate != "") ? $engDate : date("Y-m-d"); + $NepaliDate = NepaliDate1($engDate); + $nD = explode("-", $NepaliDate); + $Day = '1'; + $Month = $nD[1]; + $Year = $nD[0]; + $t = "select ad_date from tbl_nepengcalendar where bs_date like '" . $Year . "-" . $Month . "-%' order by ad_date"; + $dates = DB::select($t); + $date = end($dates); + return $date->ad_date; + } +} + +if (!function_exists('EnglishDate')) { + function EnglishDate($NepaliYear, $NepaliMonth, $NepaliDay) + { + if ($NepaliMonth < 10) { + $NepaliMonth = "0" . $NepaliMonth; + } + $bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay; + $t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'"; + $q = DB::select($t); + return $q[0]->ad_date; + } +} + +if (!function_exists('Today')) { + function Today() + { + return date("Y-m-d"); + } +} + +if (!function_exists('NepaliToEnglishDate')) { + function NepaliToEnglishDate($NepaliDate) + { + $NepaliDate = trim($NepaliDate); + if (trim($NepaliDate) == "") { + return date("Y-m-d"); + } + $NepaliDate = explode("-", $NepaliDate); + $NepaliMonth = intval($NepaliDate[1]); + $NepaliYear = intval($NepaliDate[0]); + $NepaliDay = intval($NepaliDate[2]); + if ($NepaliMonth < 10) { + $NepaliMonth = "0" . $NepaliMonth; + } + $bs_date = $NepaliYear . "-" . $NepaliMonth . "-" . $NepaliDay; + $t = "select ad_date from tbl_nepengcalendar where bs_date='$bs_date'"; + $q = DB::select($t); + return $q[0]->ad_date; + } +} + +if (!function_exists('NepaliDate')) { + function NepaliDate($engDate = "") + { + $engDate = ($engDate != "") ? $engDate : date("Y-m-d"); + if ($engDate != "0000-00-00") { + // return str_replace("-0", "-", DB::table('tbl_nepengcalendar')->where('ad_date', $engDate)->first()->bs_date); + $result = DB::table('tbl_nepengcalendar')->where('ad_date', $engDate)->first(); + + if ($result) { + $bsDate = $result->bs_date; + $convertedDate = convertNumbersToUnicode(str_replace("-", "-", $bsDate)); + return $convertedDate; + } else { + // Handle the case when the query result is null + return null; + } + } else { + return ""; + } + } +} +function convertNumbersToUnicode($number = "2080-10-13") +{ + $unicodeDigits = [ + '0' => '०', + '1' => '१', + '2' => '२', + '3' => '३', + '4' => '४', + '5' => '५', + '6' => '६', + '7' => '७', + '8' => '८', + '9' => '९', + ]; + + $converted = ''; + $digits = str_split((string) $number); + + foreach ($digits as $digit) { + if (isset($unicodeDigits[$digit])) { + $converted .= $unicodeDigits[$digit]; + } elseif ($digit === '-') { + $converted .= '-'; + } else { + $converted .= $digit; + } + } + //dd($converted); + return $converted; +} + + + + +if (!function_exists('NepaliMonth')) { + function NepaliMonth($engDate = "") + { + $NepaliDate = NepaliDate($engDate); + $nD = explode("-", $NepaliDate); + $Month = $nD[1]; + return intval($Month); + } +} + +if (!function_exists('NepaliYear')) { + function NepaliYear($engDate = "") + { + $NepaliDate = NepaliDate($engDate); + $nD = explode("-", $NepaliDate); + $Year = $nD[0]; + return intval($Year); + } +} + +if (!function_exists('NepaliMonthNameByNumber')) { + function NepaliMonthNameByNumber($number) + { + $MonthNames = array( + "Baisakh", + "Jestha", + "Ashad", + "Shrawan", + "Bhadra", + "Asoj", + "Kartik", + "Mangsir", + "Poush", + "Magh", + "Falgun", + "Chaitra" + ); + return $MonthNames[$number - 1]; + } +} + +if (!function_exists('NepaliMonthName')) { + function NepaliMonthName($engDate = "") + { + $Month = NepaliMonth($engDate); + $MonthNames = array( + "Baisakh", + "Jestha", + "Ashad", + "Shrawan", + "Bhadra", + "Asoj", + "Kartik", + "Mangsir", + "Poush", + "Magh", + "Falgun", + "Chaitra" + ); + return $MonthNames[$Month - 1]; + } +} + +if (!function_exists('N2')) { + function N2($N) + { + return number_format($N, 2, '.', ','); + } +} +function collectScripts(callable $callback) +{ + ob_start(); + $callback(); + $script = ob_get_clean(); + + if (!empty($script)) { + pushScriptToFooter($script); + } +} + +function pushScriptToFooter($script) +{ + if (!isset($GLOBALS['scripts'])) { + $GLOBALS['scripts'] = []; + } + + $GLOBALS['scripts'][] = $script; +} +function sectionHeader($text, $sectiontitle = null) +{ + $texts = explode(" ", $text); + ?> +
    + +
    + + + + + + +

    + + + +

    + +
    + +
    + whereRaw($condition) + ->get(); + + // Example: Creating checkboxes + foreach ($options as $option) { + $isChecked = ($option->$valueColumn == $selectedValue) ? 'checked' : ''; + + echo "
    "; + } +} + +