²é¿´/±à¼ ´úÂë
ÄÚÈÝ
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Impact; use App\Contact; use App\Page; use App\Footer; use App\Slider; use App\Bike; use App\Gallery; use App\Itineraries; use App\Post; use App\Category; use App\Testimonial; class RoutesController extends Controller { // Home Page public function home() { $sliders = Slider::orderBy('id')->get(); $footer = Footer::find(1); $page = Page::find(1); return view('home', compact('footer', 'sliders', 'page')); } // Mission Page public function mission() { $page = Page::find(2); $footer = Footer::find(1); return view('mission', compact('footer', 'page')); } // Static 'miss' Page — (corrected null find) public function miss() { $page = Page::find(3); // replace 3 with actual page ID $footer = Footer::find(1); return view('miss', compact('footer', 'page')); } // Team Page public function team() { $page = Page::where('title', 'Our Team')->get(); $footer = Footer::find(1); return view('team', compact('footer', 'page')); } // Itineraries Page public function itineraries() { $page = Page::find(5); $footer = Footer::find(1); $itineraries = Itineraries::orderBy('id')->get(); return view('itineraries', compact('footer', 'page', 'itineraries')); } public function generalInformation() { $page = Page::find(5); $footer = Footer::find(1); return view('generalInformation', compact('footer', 'page')); } public function its() { $page = Page::find(5); $footer = Footer::find(1); $itineraries = Itineraries::orderBy('id')->get(); return view('its', compact('footer', 'page', 'itineraries')); } // Bikes Page public function bikes() { $bikes = Bike::orderBy('id')->get(); $footer = Footer::find(1); return view('bikes', compact('footer', 'bikes')); } // Impact Page public function impact() { $impacts = Impact::orderBy('id')->get(); $page = Page::find(4); $footer = Footer::find(1); return view('impact', compact('page', 'footer', 'impacts')); } // Gallery Page public function gallery() { $galleries1 = Gallery::orderBy('id')->take(3)->get(); $galleries2 = Gallery::where('id', '>', 4)->orderBy('id')->get(); $footer = Footer::find(1); return view('gallery1', compact('footer', 'galleries1', 'galleries2')); } // Contact Page public function contact() { $contact = Contact::find(1); $footer = Footer::find(1); return view('contact-us', compact('contact', 'footer')); } // Testimonials Page public function testimonials() { $testimonials = Testimonial::orderBy('id', 'DESC')->paginate(3); $footer = Footer::find(1); return view('testimonials', compact('testimonials', 'footer')); } public function testimonial(Request $request) { $testimonial = Testimonial::findOrFail($request->id); $footer = Footer::find(1); return view('testimonial-single', compact('testimonial', 'footer')); } // Blog List public function blog() { $footer = Footer::find(1); $posts = Post::with(['user', 'category']) ->where('status', 'published') ->orderBy('id', 'desc') ->paginate(6); $featured = Post::with(['user', 'category']) ->where('status', 'published') ->where('is_featured', 1) ->orderBy('id', 'desc') ->paginate(6); // return view('posts', compact('posts', 'featured', 'footer')); return view('blog.posts.index', compact('posts', 'featured', 'footer')); } // Blog Article by Slug public function article(Request $request) { $post = Post::with('category') ->where('slug', $request->slug) ->where('status', 'published') ->firstOrFail(); $footer = Footer::find(1); $categories = Category::orderBy('id', 'desc')->get(); return view('post', compact('post', 'categories', 'footer')); } // Articles by Category public function articlesByCat(Request $request) { $category = Category::where('slug', $request->slug)->firstOrFail(); $posts = Post::where('status', 'published') ->where('category_id', $category->id) ->orderBy('id', 'desc') ->paginate(6); $footer = Footer::find(1); return view('post-category', compact('posts', 'category', 'footer')); } }