<?php

namespace App\Http\Controllers\Account;


use App\Models\UserInvitation;

class ShowRegistrationFormController
{

    /** @var UserInvitation */
    private $repository;

    /**
     * ShowRegistrationFormController constructor.
     * @param UserInvitation $repository
     */
    public function __construct(UserInvitation $repository)
    {
        $this->repository = $repository;
    }


    public function show(string $email, string $hash){
        $invite = $this->repository->where('email', $email)->where('hash', $hash)->first();

        if($invite){
            return view('pages.authentication.registration', ['invite' => $invite]);
        }

        return redirect()->route('login');
    }

}