Manual mails can be sent
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Event\Controllers\MailCompose;
|
||||
|
||||
use App\Scopes\CommonController;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ByGroupController extends CommonController
|
||||
{
|
||||
public function __invoke(string $eventIdentifier, string $groupType, Request $request) {
|
||||
$event = $this->events->getByIdentifier($eventIdentifier, true);
|
||||
$recipients = [];
|
||||
switch ($groupType) {
|
||||
case 'by-local-group':
|
||||
$participants = $this->eventParticipants->groupByLocalGroup($event, $request, $request->input('groupName'));
|
||||
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
||||
break;
|
||||
case 'by-participation-group':
|
||||
$participants = $this->eventParticipants->groupByParticipationType($event, $request, $request->input('groupName'));
|
||||
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
||||
break;
|
||||
case 'signed-off':
|
||||
$participants = $this->eventParticipants->getSignedOffParticipants($event, $request, $request->input('groupName'));
|
||||
$recipients = $this->eventParticipants->getMailAddresses($participants[$request->input('groupName')]);
|
||||
break;
|
||||
default:
|
||||
$participants = $this->eventParticipants->getForList($event, $request);
|
||||
$recipients = $this->eventParticipants->getMailAddresses($participants);
|
||||
|
||||
}
|
||||
|
||||
return response()->json(['recipients' => $recipients]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user