Files
mareike/app/Domains/Event/Controllers/ParticipantSignOffController.php
2026-04-11 22:17:38 +02:00

30 lines
1.0 KiB
PHP

<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateCommand;
use App\Domains\Event\Actions\SetParticipationState\SetParticipationStateSignoffRequest;
use App\Scopes\CommonController;
use DateTime;
use Illuminate\Http\Request;
class ParticipantSignOffController extends CommonController
{
public function __invoke(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$signOffDate = DateTime::createFromFormat('Y-m-d', $request->input('cancel_date'));
$signOffRequest = new SetParticipationStateSignoffRequest($participant, $signOffDate);
$signOffCommand = new SetParticipationStateCommand($signOffRequest);
$signOffCommand->execute();
return response()->json([
'status' => 'success',
'identifier' => $participant->identifier,
'message' => 'Die Abmeldung wurde erfolgreich durchgeführt.'
]);
}
}