<?php

namespace App\Http\Controllers\Marketing;

use App\Http\Controllers\Controller;
use App\Models\GiftVoucher;
use Illuminate\Http\Request;

class GiftVoucherPrintController extends Controller
{
    public function __invoke(Request $request, GiftVoucher $voucher)
    {
        if ($voucher->code !== strtoupper($request->query('code'))) {
            abort(404);
        }

        return view('marketing.gift-voucher-print', [
            'voucher' => $voucher,
        ]);
    }
}
