master_template/app/Helpers/CCMS.php

56 lines
1.8 KiB
PHP
Raw Normal View History

2024-06-10 12:21:58 +00:00
<?php
use App\Models\Menuitems;
use App\Models\Menulocations;
use App\Models\Preparationclasses;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
class CCMS
{
// public function __construct()
// {
// $this->initDB();
// }
2024-06-13 15:17:05 +00:00
public static function getSiteVars()
{
$siteVars = DB::table("settings")->where('status', 1)->orderby('display_order')->first();
return $siteVars;
}
2024-06-10 12:21:58 +00:00
2024-06-13 15:17:05 +00:00
public static function createMenuLink($text, $URL)
{
$isActive = request()->fullUrl() == $URL;
$activeClass = $isActive ? 'active' : '';
?>
<li>
<a class="nav-link menu-link <?php echo $activeClass; ?>" href="<?php echo $URL; ?>"><i class="ri-file-text-line "></i> <span data-key="t-landing">
<?php echo $text; ?>
</span></a>
</li>
<?php
}
2024-06-10 12:21:58 +00:00
// private function initDB()
// {
// static $initialized = false;
// if (!$initialized) {
2024-06-13 15:17:05 +00:00
2024-06-10 12:21:58 +00:00
// if (!(DB::table('users')->first())) {
// DB::statement("INSERT INTO `tbl_users` (`name`,`email`,`username`,`password`,`status`) VALUES ('Prajwal Adhikari','prajwalbro@hotmail.com','prajwalbro@hotmail.com','$2y$10$3zlF9VeXexzWKRDPZuDio.W7RZIC3tU.cjwMoLzG8ki8bVwAQn1WW','1');");
// }
// if (!(DB::table('settings')->first())) {
// DB::statement("INSERT INTO `tbl_settings` (`title`, `description`, `status`) values ('Bibhuti LMS', '', '1');");
// }
// if (!(DB::table('articles')->first())) {
// DB::statement("INSERT INTO `tbl_articles` (`title`,`alias`, `text`, `status`) VALUES ('Company Profile', 'company-profile','Welcome Article', '1');");
// }
// $initialized = true;
// }
// }
}