initDB(); } public static function showCount($table) { $count = DB::table($table)->where('status', '!=', -1)->count(); return $count; } public static function createMenuLink($text, $URL) { $isActive = request()->fullUrl() == $URL; $activeClass = $isActive ? 'active' : ''; ?>
  • where('status', 1)->orderBy('display_order')->get(); return $Gallery; } public static function getCustomFields() { $Rows = DB::table('customfields')->where('status', 1)->orderBy('display_order')->get(); return $Rows; } public static function getGallery($gallery_id) { $Gallery = DB::select("select * from tbl_galleries where gallery_id='$gallery_id'")[0]; $clients = DB::select('select * from tbl_photos where galleries_id=' . $Gallery->gallery_id . ' and status=1'); return $clients; } public static function getGalleryByAlias($alias) { $alias = trim($alias, "'\""); // Remove leading/trailing quotes, if present $gallery = DB::table("galleries")->where('alias', $alias)->first(); if (!$gallery) { return null; } $photos = DB::table('photos')->where('galleries_id', $gallery->gallery_id)->where('status', 1)->get(); return $photos; } public static function getarticle($alias = '') { $t = "select * from tbl_companyarticles where status=1"; if ($alias != '') { $t .= " and alias='$alias'"; // dd($t); $Article = DB::select($t); if (!$Article) $Article = DB::select("select * from tbl_companyarticles where status=1 LIMIT 1"); $Article = $Article[0]; $Aboutus = $Article; $q = "select * from tbl_companyarticles where parent_article=$Aboutus->article_id"; $Aboutus->children = DB::select($q); } else { $Aboutus = DB::select($t); } //dd($Aboutus);die; return $Aboutus; } public static function getgalleries($alias = '', $limit = "") { $q = "select * from tbl_galleries "; if ($alias != '') { $q .= " where alias='$alias'"; $Gallerys = DB::select($q)[0]; $t = 'select * from tbl_photos where galleries_id=' . $Gallerys->gallery_id . ' and status=1 ORDER BY photo_id DESC'; if ($limit != '') { $t .= " limit $limit"; } $Gallerys->images = DB::select($t); } else { $Gallerys = DB::select($q); foreach ($Gallerys as $Gallery) { $t = 'select * from tbl_photos where galleries_id=' . $Gallery->gallery_id . ' and status=1 ORDER BY photo_id DESC'; if ($limit != '') { $t .= " limit $limit"; } $Gallery->images = DB::select($t); } } // BIBHelper::pre($Gallerys); return $Gallerys; } static public function showMenu($menulocation_alias) { $MenuItems = MPCMS::getMenuItems($menulocation_alias); // dd($MenuItems); ?> where('alias', $menulocation_alias) ->value('menulocation_id'); // dd($menulocation_alias); $menuItems = DB::table('menuitems') ->where('menulocations_id', $menulocations_id) ->where('parent_menu', $parentId) ->where('status', '<>', -1) ->orderBy('display_order') ->get(); // dd($menuItems); $result = []; foreach ($menuItems as $menuItem) { $children = self::getMenuItems($menulocation_alias, $menuItem->menu_id); $menuItem->children = $children; $result[] = $menuItem; } // dd($result); return $result; } public static function getFooMenuItems($menulocation_alias, $parentId = 0) { $menulocations_id = DB::table('menulocations') ->where('alias', $menulocation_alias) ->value('menulocation_id'); // dump($menulocations_id); $menuItems = DB::table('menuitems') ->where('menulocations_id', $menulocations_id) // ->where('parent_menu', $parentId) ->where('status', '<>', -1) ->orderBy('display_order') ->get(); // dd($menuItems); $result = []; foreach ($menuItems as $menuItem) { $children = self::getMenuItems($menulocation_alias, $menuItem->menu_id); $menuItem->children = $children; $result[] = $menuItem; } // dd($result); return $result; } public static function getSiteVars() { $siteVars = DB::table("settings")->where('status', 1)->orderby('display_order')->get(); return $siteVars[0]; } public static function getCountries() { $Countries = DB::table("countries")->where('status', 1)->orderby('display_order')->get(); return $Countries; } public static function getCountry($alias) { $Countries = DB::table("countries")->where('alias', $alias)->get(); return $Countries[0]; } public static function getDemandCountries() { $demandCountries1 = DB::table('jobdemands')->where('status', 1)->orderby('display_order')->pluck('countries_id'); $demandCountries2 = DB::table('paperdemands')->where('status', 1)->orderby('display_order')->pluck('countries_id'); $demandCountries = $demandCountries1->concat($demandCountries2); // pre($demandCountries2,true); $demandCountries = DB::table("countries")->where('status', 1)->orderby('display_order')->whereIn('country_id', $demandCountries)->get(); return $demandCountries; } public static function getCertificates() { $Certificates = DB::table("certificates")->where('status', 1)->orderby('display_order')->get(); return $Certificates; } public static function getCertificate($alias) { $Certificate = DB::table("certificates")->where('alias', $alias)->get()[0]; return $Certificate; } public static function getTeams() { $Teams = DB::table("teams")->where('status', 1)->orderby('display_order')->get(); return $Teams; } public static function getTeam($alias) { $Team = DB::table("teams")->where('alias', $alias)->get()[0]; return $Team; } public static function getPaperDemands($limit = 0) { $query = DB::table("paperdemands")->where('status', 1)->orderBy('display_order'); if ($limit > 1) { $query->take($limit); } $PaperDemands = $query->get(); return $PaperDemands; } public static function getPaperDemand($alias) { $PaperDemand = DB::table("paperdemands")->where('alias', $alias)->get()[0]; return $PaperDemand; } public static function getJobCategories() { $JobCategories = DB::table("job_categories")->where('status', 1)->orderby('display_order')->get(); return $JobCategories; } public static function getJobCategory($alias) { $JobCategory = DB::table("job_categories")->where('alias', $alias)->get()[0]; return $JobCategory; } public static function getCompanies() { $Companies = DB::table("companies")->where('status', 1)->orderby('display_order')->get(); return $Companies; } public static function getCompany($alias) { $Company = DB::table("companies")->where('alias', $alias)->get()[0]; return $Company; } 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 '
    '; } function initDB() { DB::statement("CREATE TABLE IF NOT EXISTS tbl_franchises ( franchise_id INT(11) AUTO_INCREMENT PRIMARY KEY, title text NULL, alias text NULL, text TEXT NULL, thumb VARCHAR(255), banners VARCHAR(255), display_order INT(11) NULL, status INT(11) DEFAULT 1, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, createdby INT(11) DEFAULT 1, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, updatedby INT(11) DEFAULT 1 );"); DB::statement("CREATE TABLE IF NOT EXISTS tbl_partners ( partner_id INT(11) AUTO_INCREMENT PRIMARY KEY, title text NULL, alias text NULL, text TEXT NULL, thumb VARCHAR(255), display_order INT(11) NULL, status INT(11) DEFAULT 1, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, createdby INT(11) DEFAULT 1, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, updatedby INT(11) DEFAULT 1 );"); DB::statement("CREATE TABLE IF NOT EXISTS tbl_services ( service_id INT(11) AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NULL, alias VARCHAR(255) NULL, sub_text TEXT NULL, text TEXT NULL, icon VARCHAR(255) NULL, thumb VARCHAR(255), display_order INT(11) NULL, status INT(11) DEFAULT 1, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, createdby INT(11) DEFAULT 1, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, updatedby INT(11) DEFAULT 1 );"); DB::statement("CREATE TABLE IF NOT EXISTS tbl_testimonials ( testimonial_id INT(11) AUTO_INCREMENT PRIMARY KEY, title VARCHAR(255) NULL, alias VARCHAR(255) NULL, text TEXT NULL, designation VARCHAR(255) NULL, thumb VARCHAR(255), display_order INT(11) NULL, status INT(11) DEFAULT 1, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, createdby INT(11) DEFAULT 1, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, updatedby INT(11) DEFAULT 1 );"); DB::statement("CREATE TABLE IF NOT EXISTS tbl_customfields ( customfield_id INT(11) AUTO_INCREMENT PRIMARY KEY, customfield_for VARCHAR(250) NULL, customfield_forref VARCHAR(250) NULL, title VARCHAR(255) NULL, alias VARCHAR(255) NULL, text TEXT NULL, fa_icon VARCHAR(255), logo VARCHAR(255), display_order INT(11) NULL, status INT(11) DEFAULT 1, remarks TEXT NULL, created_at DATETIME DEFAULT CURRENT_TIMESTAMP, createdby INT(11) DEFAULT 1, updated_at DATETIME DEFAULT CURRENT_TIMESTAMP, updatedby INT(11) DEFAULT 1 );"); if (!Schema::hasColumn('users', 'status')) { Schema::table('users', function (Blueprint $table) { // Add the new column to the table $table->string('status')->nullable(); }); } if (!Schema::hasColumn('users', 'display_order')) { Schema::table('users', function (Blueprint $table) { // Add the new column to the table $table->string('display_order')->nullable(); }); } if (!Schema::hasColumn('users', 'createdBy')) { Schema::table('users', function (Blueprint $table) { // Add the new column to the table $table->integer('createdBy')->nullable(); }); } if (!Schema::hasColumn('users', 'updatedBy')) { Schema::table('users', function (Blueprint $table) { // Add the new column to the table $table->integer('updatedBy')->nullable(); }); } if (!Schema::hasColumn('companyarticles', 'location')) { Schema::table('companyarticles', function (Blueprint $table) { // Add the new column to the table $table->string('location')->nullable()->after('parent_article'); }); } Schema::table('companyarticles', function (Blueprint $table) { if (!Schema::hasColumn('companyarticles', 'FBenfitTitle')) { $table->string('FBenfitTitle')->nullable()->after('text'); } if (!Schema::hasColumn('companyarticles', 'SBenfitTitle')) { $table->string('SBenfitTitle')->nullable()->after('text'); } if (!Schema::hasColumn('companyarticles', 'TBenfitTitle')) { $table->string('TBenfitTitle')->nullable()->after('text'); } if (!Schema::hasColumn('companyarticles', 'FBenfitText')) { $table->text('FBenfitText')->nullable()->after('text'); } if (!Schema::hasColumn('companyarticles', 'SBenfitText')) { $table->text('SBenfitText')->nullable()->after('text'); } if (!Schema::hasColumn('companyarticles', 'TBenfitText')) { $table->text('TBenfitText')->nullable()->after('text'); } }); Schema::table('franchises', function (Blueprint $table) { if (!Schema::hasColumn('franchises', 'for')) { $table->text('for')->nullable()->after('franchise_id'); } if (!Schema::hasColumn('franchises', 'link')) { $table->string('link')->nullable()->after('banners'); } }); Schema::table('settings', function (Blueprint $table) { if (!Schema::hasColumn('settings', 'address')) { $table->string('address')->nullable()->after('email'); } }); Schema::table('services', function (Blueprint $table) { if (!Schema::hasColumn('services', 'parent_service')) { $table->integer('parent_service')->nullable()->after('service_id'); } }); } }