timestamp = Carbon::now()->setTimezone(wp_timezone())->addWeek()->startOfWeek(1)->setTime(9, 0, 0)->unix(); parent::__construct(); } public function run() { /** * @var Chatbot[]|\AIMuseVendor\Illuminate\Database\Eloquent\Collection $chatbots */ $chatbots = Chatbot::all(); Log::info('Running weekly chatbot notification schedule', [ 'chatbots' => $chatbots->count(), ]); foreach ($chatbots as $chatbot) { $enabled = Arr::get($chatbot->settings, 'notifications.weekly.enabled', false); if (!$enabled) return; $chatbot->notify('weekly'); } } }