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)); } } }