This commit is contained in:
tanch0 2024-06-11 10:24:25 +05:45
parent b3ee8845a8
commit 567d179a36

View File

@ -29,9 +29,9 @@ class WebsiteController extends Controller
{
$this->path = config('app.client_path');
$headerMenu = Menulocations::where('alias', 'header-menu')->first();
$headerMenuItems = Menuitems::where('menulocations_id', $headerMenu->menulocation_id)->where('status','<>',-1)->where('parent_menu', 0)->with('children')->orderBy('display_order', 'asc')->get();
$headerMenuItems = Menuitems::where('menulocations_id', $headerMenu->menulocation_id)->where('status', '<>', -1)->where('parent_menu', 0)->with('children')->orderBy('display_order', 'asc')->get();
$footerMenu = Menulocations::where('alias', 'footer-menu')->first();
$footerMenuItems = Menuitems::where('menulocations_id', $footerMenu->menulocation_id)->where('status','<>',-1)->where('parent_menu', 0)->with('children')->orderBy('display_order', 'asc')->get();
$footerMenuItems = Menuitems::where('menulocations_id', $footerMenu->menulocation_id)->where('status', '<>', -1)->where('parent_menu', 0)->with('children')->orderBy('display_order', 'asc')->get();
$popularNews = News::inRandomOrder()->inRandomOrder()->take(3)->get();
View::share([
'headerMenuItems' => $headerMenuItems,
@ -40,54 +40,17 @@ class WebsiteController extends Controller
]);
}
// public static function index(Request $request, $menu_id = "")
// {
// dd("test");
// $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." . env("CLIENT_PATH") . ".inside.contact", compact('contact'));
// // break;
// case 'tbl_countries':
// $countries = DB::table("countries")->where("article_id", $menuItem->ref)->get()[0];
// return view("client." . env("CLIENT_PATH") . ".inside.country_single", compact('country'));
// break;
// case 'tbl_companyarticles':
// $article = DB::table("companyarticles")->where("article_id", $menuItem->ref)->get()[0];
// return view("client." . env("CLIENT_PATH") . ".inside.article", compact('article'));
// //break;
// case 'tbl_recruitmentarticles':
// $recruitmentarticle = DB::table("recruitmentarticles")->where("article_id", $menuItem->ref)->get()[0];
// $article = $recruitmentarticle;
// return view("client." . env("CLIENT_PATH") . ".inside.recruitmentArticle", compact('recruitmentarticle', 'article'));
// case 'tbl_otherarticles':
// $cruiserecruiment = DB::table("otherarticles")->where("article_id", $menuItem->ref)->get()[0];
// $article = $cruiserecruiment;
// return view("client." . env("CLIENT_PATH") . ".inside.cruiserecruitment", compact('cruiserecruiment', 'article'));
// default:
// // echo $menuItem->alias;die;
// if ($menuItem->ref == "/")
// return view("client." . env("CLIENT_PATH") . ".welcome");
// else if ($menuItem->ref == "#")
// return view("client." . env("CLIENT_PATH") . ".welcome");
// else
// return view("client." . env("CLIENT_PATH") . ".inside" . '/' . ltrim($menuItem->ref));
// }
// }
public function home()
{
$data["sliders"] = Sliders::where('status', 1)->latest()->get();
$data["franchises"] = Franchises::latest()->take(4)->get();
$data["testimonials"] = Testimonials::where('status', 1)->latest()->get();
$data['services'] = Services::latest()->where('parent_service',null)->where('status', 1)->take(6)->get();
$data['services'] = Services::latest()->where('parent_service', null)
->orWhere('parent_service', 0)
->where('status', 1)
->inRandomOrder()
->get();
$data['partners'] = Partners::latest()->get();
$data["news"] = News::latest()->take(6)->get();
@ -121,7 +84,7 @@ class WebsiteController extends Controller
$teams = Teams::where('status', 1)->latest()->get();
return view("client.$this->path.article-single", compact('teams', 'alias', 'article','whyChooseUs'));
return view("client.$this->path.article-single", compact('teams', 'alias', 'article', 'whyChooseUs'));
}
public function teams()
@ -166,11 +129,11 @@ class WebsiteController extends Controller
public function showService($alias)
{
$serviceLists = Services::where('status', 1)
->whereNull('parent_service')
->orWhere('parent_service', 0)
->select(['title', 'alias'])
->get();
$service = Services::where('alias', $alias)->where('status','<>',-1)->with('children',fn($query)=>$query->latest())->first();
->whereNull('parent_service')
->orWhere('parent_service', 0)
->select(['title', 'alias'])
->get();
$service = Services::where('alias', $alias)->where('status', '<>', -1)->with('children', fn ($query) => $query->latest())->first();
return view('client.topCargo.service-single', compact('service', 'serviceLists'));
}
@ -224,9 +187,6 @@ class WebsiteController extends Controller
} else {
return response()->json(['error' => 'Failed to send email'], 500);
}
}
}
}