Fixed cronjobs
This commit is contained in:
+14
-12
@@ -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,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user