Files
mareike/app/Providers/DoubleCheckEventRegistrationProvider.php

31 lines
692 B
PHP

<?php
namespace App\Providers;
use App\Models\Event;
use DateTime;
class DoubleCheckEventRegistrationProvider {
function __construct(
private Event $event,
private string $firstname,
private string $lastname,
private string $email,
private DateTime $birthday,
) {}
public function isRegistered() : bool
{
$checkconditions = array(
'firstname' => $this->firstname,
'lastname' => $this->lastname,
'email_1' => $this->email,
'birthday' => $this->birthday->format('Y-m-d'),
);
return $this->event->participants()->where($checkconditions)->exists();
}
}