open() ->whereNull('reminded_at') ->where('created_at', '<=', now()->subMinutes(config('fewo.channels.task_reminder_after_minutes'))) ->with('channel') ->get(); if ($tasks->isEmpty()) { return 0; } Mail::to(Settings::notificationRecipients())->send(new ChannelTasksNotification($tasks->all(), reminder: true)); ChannelTask::whereKey($tasks->modelKeys())->update(['reminded_at' => now()]); return $tasks->count(); } }