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

35 lines
1.5 KiB
PHP

<?php
namespace App\Domains\Event\Controllers;
use App\Domains\Event\Actions\ManualCertificateOfConductionCheck\ManualCertificateOfConductionCheckCommand;
use App\Domains\Event\Actions\ManualCertificateOfConductionCheck\ManualCertificateOfConductionCheckRequest;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentCommand;
use App\Domains\Event\Actions\ParticipantPayment\ParticipantPaymentRequest;
use App\Models\EventParticipant;
use App\Scopes\CommonController;
use Illuminate\Support\Facades\Request;
class ParticipantController extends CommonController {
public function markCocExisting(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events);
$cocRequest = new ManualCertificateOfConductionCheckRequest($participant);
$cocCommand = new ManualCertificateOfConductionCheckCommand($cocRequest);
$cocResponse = $cocCommand->execute();
return response()->json([
'status' => $cocResponse->success ? 'success' : 'error',
'message' => $cocResponse->success ? 'Das eFZ wurde als gültig hinterlegt' : 'Beim Aktualisieren des eFZ-Status ist ein Fehler aufgetreten.'
]);
}
public function __invoke(string $participantIdentifier, Request $request) {
$participant = $this->eventParticipants->getByIdentifier($participantIdentifier, $this->events)->toResource()->toArray($request);
return response()->json([
'participant' => $participant,
]);
}
}