<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Artesaos\SEOTools\Facades\SEOTools;
use Artesaos\SEOTools\Facades\SEOMeta;
use App\Models\Facilities;
class FacilitiesViewController extends Controller
{
    public function index()
    {
        $title = 'Facilities | Polytechnic College of Davao del Sur';
        $description = 'Polytechnic College of Davao del Sur offers modern labs, smart classrooms & industry-ready training — shaping top tech & vocational professionals.';
        SEOTools::setTitle($title, false);
        SEOTools::setDescription($description);
        SEOTools::opengraph()->setUrl(url()->current());

        $facilities = Facilities::latest()->get();

        return view('front.pages.facilities.photo-facilities', [
            'pageTitle' => $title,
            'facilities' => $facilities,
        ]);
    }
    public function facilitiesPhoto(Facilities $facilities)
    {
        $title = $facilities->name . ' | Polytechnic College of Davao del Sur';
        SEOTools::setTitle($title,false);
        SEOTools::setDescription('Photos of : ' . $facilities->name);
        SEOTools::opengraph()->setUrl(url()->current());

        $photos = $facilities->photos()->latest()->get(); // Assumes Album has a `photos()` relationship

        return view('front.pages.facilities.facilities-view', [
            'facilities' => $facilities,
            'facility_photos' => $photos,
            'pageTitle' => $title
        ]);
    }
}
