programService = $programService; $headerMenus = getAllHeaderMenusWithChildren(); $footerMenus = getAllFooterMenusWithChildren(); $tests = Test::where('status', 1)->where('parent_id', null)->get(); $countries = Country::where('status', 1)->where('parent_id', null)->get(); $interviews = Service::where('status', 1)->where('parent_id', null)->get(); $services = Service::where('status', 1)->where('parent_id', null)->get(); $this->path = config('app.client'); view()->share([ 'headerMenus' => $headerMenus, 'footerMenus' => $footerMenus, 'tests' => $tests, 'countries' => $countries, 'services' => $services, 'interviews' => $interviews, ]); } public function home() { $data['sliders'] = getSliders(limit: null, order: 'asc'); $data['counters'] = getCounters(limit: null, order: 'asc'); $data['successGalleries'] = getGalleriesByCategory(limit: 3, order: 'asc', category: 'voice-of-success'); $data['destinations'] = getDestinations(limit: null, order: 'asc'); $data['services'] = getServices(limit: null, order: 'asc'); $data['classes'] = getClasses(limit: null, order: 'asc'); $data['institutions'] = getInstitutions(limit: null, order: 'asc'); $data['faqs'] = getFAQs(limit: null, order: 'desc'); $data['testimonials'] = getTestimonials(limit: null, order: 'desc'); $data['blogs'] = getBlogs(limit: 4, order: 'desc'); $data['partners'] = getPartners(limit: 4, order: 'desc'); $data['gallaries'] = getGalleries(limit: 6, order: 'asc'); $data['achievementGalleries'] = getGalleriesByCategory(limit: null, order: 'asc', category: 'achievement'); $data['visaGalleries'] = getGalleriesByCategory(limit: null, order: 'asc', category: 'visa-success'); $page = $data['page'] = getPageWithChildrenBySlug(parent: null, slug: '/', limit: null, order: 'asc'); if (!$page) { return view("client.$this->path.errors.404"); } $path = "client.$this->path.pages.$page->template"; if (!View::exists($path)) { return view("client.$this->path.errors.404"); } return view($path, $data); } public function blogSingle($alias) { $blog = $data["page"] = Blog::where('status', 1) ->where('slug', $alias)->first(); $data['blogs'] = getBlogs(limit: null, order: 'desc'); if (!$blog) { return view("client.$this->path.errors.404"); } $data['categories'] = getBlogCategories(limit: null, order: 'desc'); $data['recentBlogs'] = Blog::where('status', 1) ->where('id', '!=', $blog->id) ->inRandomOrder() ->orderBy('created_at', 'desc') ->take(5)->get(); $blog->increment('views'); return view("client.$this->path.pages.blog-single-template", $data); } public function serviceSingle($alias) { $service = $data["page"] = Service::where('status', 1) ->where('slug', $alias) ->with('children', function ($query) { $query->where('status', 1) ->orderBy('order'); }) ->first(); if (!$service) { return view("client.$this->path.errors.404"); } $data['recentServices'] = Service::where('status', 1) ->where('parent_id', null) ->orderBy('created_at', 'desc') ->inRandomOrder() ->take(5)->get(); $data['serviceFAQs'] = getFAQsByCategory(limit: null, order: 'desc', category: $service->slug); return view("client.$this->path.pages.test-single-template", $data); } public function testSingle($alias) { $testPreparations = $data["page"] = Test::where('status', 1) ->where('slug', $alias) ->with('children', function ($query) { $query->where('status', 1) ->orderBy('order'); }) ->first(); if (!$testPreparations) { return view("client.$this->path.errors.404"); } return view("client.$this->path.pages.test-single-template", $data); } public function countrySingle($alias) { $country = $data["page"] = Country::where('status', 1) ->where('slug', $alias) ->with('institutions', function ($query) { $query->where('status', 1); }) ->first(); if (!$country) { return view("client.$this->path.errors.404"); } $data['countryFAQs'] = getFAQsByCategory(limit: null, order: 'desc', category: $country->slug); $data['countryInstitutions'] = $country->institutions; $data['recentCountries'] = Country::where('status', 1) ->where('id', '!=', $country->id) ->inRandomOrder() ->orderBy('created_at', 'desc') ->take(5)->get(); return view("client.$this->path.pages.study-destination-template", $data); } public function loadPage(?string $parent = null, ?string $slug = null) { if ($slug === null) { $slug = $parent; $parent = null; } $page = getPageWithChildrenBySlug(parent: $parent, slug: $slug, limit: null, order: 'asc'); $teams = getTeams(limit: null, order: 'asc'); $blogs = getBlogs(limit: null, order: 'asc'); if (!$page) { return view('client.raffles.errors.404'); } $path = "client.$this->path.pages.$page->template"; if (!View::exists($path)) { return view('client.raffles.errors.404'); } return view($path, ['page' => $page, 'teams' => $teams, 'blogs' => $blogs]); } public function fallback() { return view("client.$this->path.errors.404"); } public function coursefinder(Request $request) { $data['page'] = Page::where(['slug' => 'course-finder', 'status' => 1])->first(); $data['title'] = 'Program List'; $data['programs'] = $this->programService->findAll($request); $data['countryOptions'] = Country::where('status', 1)->where('parent_id', null)->pluck('title', 'id'); $data['institutionOptions'] = Institution::query() ->when($request->filled('country_id'), function ($query) use ($request) { $query->where('country_id', $request->country_id); }) ->pluck('title', 'id'); $data['programLevelOptions'] = ProgramLevel::where('status', 1)->pluck('title', 'id'); $data['intakeOptions'] = Program::INTAKE; $data['coopOptions'] = Coop::where('status', 1)->pluck('title', 'id'); $data['testOptions'] = Test::where('status', 1)->where('parent_id', null)->pluck('title', 'id'); $data['statusOptions'] = config('constants.page_status_options'); return view("client.$this->path.pages.coursefinder-template", $data); } public function coursefinderSingle($id) { $course = $data["page"] = Program::where('status', 1) ->where('id', $id) ->first(); $data['intakeOptions'] = Program::INTAKE; if (!$course) { return view("client.$this->path.errors.404"); } return view("client.raffles.pages.coursefinder-single", $data); } public function resources() { $data['countries'] = Country::where('status', 1)->where('parent_id', null)->get(); $data['tests'] = Test::where('status', 1)->where('parent_id', null)->get(); $data['interviews'] = Service::where('status', 1)->where('parent_id', null)->get(); return view("client.raffles.pages.resources-template", $data); } }