34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Event\Controllers;
|
|
|
|
use App\Domains\Event\Actions\SendMissingPaymentMails\SendMissingPaymentMailsCommand;
|
|
use App\Domains\Event\Actions\SendMissingPaymentMails\SendMissingPaymentMailsRequest;
|
|
use App\Scopes\CommonController;
|
|
use Illuminate\Http\Request;
|
|
|
|
class PaymentReminderController extends CommonController
|
|
{
|
|
public function __invoke(string $eventIdentifier, Request $request)
|
|
{
|
|
$event = $this->events->getByIdentifier($eventIdentifier, true);
|
|
|
|
$sendPaymentReminderMailsRequest = new SendMissingPaymentMailsRequest(
|
|
event: $event,
|
|
eventParticipants: $this->eventParticipants,
|
|
httpRequest: $request
|
|
);
|
|
|
|
$sendPaymentReminderMailsCommand = new SendMissingPaymentMailsCommand(request: $sendPaymentReminderMailsRequest);
|
|
$sendPaymentReminderResponse = $sendPaymentReminderMailsCommand->execute();
|
|
|
|
return response()->json([
|
|
'success' => $sendPaymentReminderResponse->success,
|
|
'message' => $sendPaymentReminderResponse->success ?
|
|
sprintf('Es wurden %1$s Personen über fehlende Teilnahmebeiträge informiert', $sendPaymentReminderResponse->remindedParticipants) :
|
|
'Beim Senden der Benachrichtigungen ist ein Fehler aufgetreten.',
|
|
|
|
]);
|
|
}
|
|
}
|