Signup for events implemented
This commit is contained in:
30
app/Providers/DoubleCheckEventRegistrationProvider.php
Normal file
30
app/Providers/DoubleCheckEventRegistrationProvider.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user