42 lines
1.2 KiB
PHP
42 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Tasks;
|
|
|
|
use App\Domains\Invoice\Actions\UploadInvoice\UploadInvoiceCommand;
|
|
use App\Domains\Invoice\Actions\UploadInvoice\UploadInvoiceRequest;
|
|
use App\Mail\EventReportMails\InformLocalGroupMail;
|
|
use App\Mail\ParticipantParticipationMails\ParticipantSignOffMail;
|
|
use App\Models\Event;
|
|
use App\Models\Tenant;
|
|
use App\Repositories\EventRepository;
|
|
use App\Repositories\InvoiceRepository;
|
|
use Illuminate\Support\Facades\Mail;
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
class NotifyTeam implements CronTask {
|
|
public function handle(): void
|
|
{
|
|
if (date('w') !== 0) {
|
|
// return;
|
|
}
|
|
|
|
$eventRepository = new EventRepository();
|
|
/** @var Event $event */
|
|
foreach ($eventRepository->getAvailable(false) as $event) {
|
|
foreach (Tenant::all() as $tenant) {
|
|
$participants = $event->participants()->where('local_group', $tenant->slug)->whereNull('unregistered_at')->get();
|
|
}
|
|
|
|
if ($participants->isEmpty()) {
|
|
continue;
|
|
}
|
|
|
|
|
|
Mail::to($tenant->email)->send(new InformLocalGroupMail(
|
|
event: $event,
|
|
participants: $participants,
|
|
));
|
|
}
|
|
}
|
|
}
|