<?php

namespace App\Http\Controllers;

use App\Models\VisitorEntry;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Storage;

class VisitorBadgeController extends Controller
{
    public function show($id)
    {
        $visitor = VisitorEntry::with('employeeMaster')->findOrFail($id);

        $photoUrl = $visitor->photo
            ? Storage::disk('public')->url($visitor->photo)
            : null;

        return view('visitor.badge', compact('visitor', 'photoUrl'));
    }
}
