get(); foreach ($bots as $bot) { $cron = new CronExpression($bot->schedule); if ($cron->isDue()) { try { $instance = app($bot->class, ['config' => $bot->config]); if ($instance instanceof BotContract) { $instance->run(); } } catch (\Throwable $e) { Log::error("Bot [{$bot->name}] failed: " . $e->getMessage()); } Log::info("Bot [{$bot->name}] executed successfully."); } } } }