TanchoToplineCargo/app/Http/Controllers/__WebsiteController.php
2024-05-05 10:32:49 +05:45

43 lines
1.7 KiB
PHP

<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request; // Import the Request class
use Illuminate\Support\Facades\DB;
class __WebsiteController extends Controller
{
public static function index(Request $request, $menu_id = "")
{
$pathInfo = ltrim($request->getPathInfo(), '/');
$r = explode('/', $pathInfo);
$menu_alias = end($r);
$menu_alias1 = str_replace("_", "-", $menu_alias);
$menuItem = DB::table("menuitems")->where("alias", $menu_alias)->orWhere("alias", $menu_alias1)->get()[0];
switch ($menuItem->type) {
case 'tbl_contacts':
$contact = DB::table("contacts")->where("contact_id", $menuItem->ref)->get()[0];
return view("client.jupiter.inside.contact", compact('contact'));
// break;
case 'tbl_countries':
//$countries=DB::table("countries")->where("article_id",$menuItem->ref)->get()[0];
//return view("client.jupiter.inside.article",compact('article'));
//break;
case 'tbl_companyarticles':
$article = DB::table("companyarticles")->where("article_id", $menuItem->ref)->get()[0];
return view("client.jupiter.inside.article", compact('article'));
//break;
case '':
default:
// echo $menuItem->alias;die;
if ($menuItem->ref == "/")
return view("client.jupiter.welcome");
else if ($menuItem->ref == "#")
return view("client.jupiter.welcome");
else
return view("client.jupiter.inside" . ltrim($menuItem->ref));
}
}
}