Fixed cronjobs

This commit is contained in:
2026-05-14 16:58:41 +02:00
parent 30cc0b79c5
commit 454d83de2e
4 changed files with 34 additions and 18 deletions
+14 -12
View File
@@ -16,26 +16,28 @@ use Psr\Log\LoggerInterface;
class NotifyTeam implements CronTask {
public function handle(): void
{
if (date('w') !== 0) {
// return;
if ((int)date('w') !== 0) {
return;
}
$eventRepository = new EventRepository();
/** @var Event $event */
foreach ($eventRepository->getAvailable(false) as $event) {
foreach (Tenant::all() as $tenant) {
echo $tenant->slug . PHP_EOL;
$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,
));
}
if ($participants->isEmpty()) {
continue;
}
Mail::to($tenant->email)->send(new InformLocalGroupMail(
event: $event,
participants: $participants,
));
}
}
}