linkedId = $linkedId; } public function handle() { $maxAttempts = 20; $attempt = 0; while ($attempt < $maxAttempts) { $exists = DB::table('inbound_reports') ->where('linkedid', $this->linkedId) ->exists(); if ($exists) { if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { \Log::info("Inbound report already exists for {$this->linkedId}"); } return; } Artisan::call('reports:inbound:process-call', [ 'linkedid' => $this->linkedId ]); sleep(2); $attempt++; } if (CompanySettings::get(SettingsHelper::S_COMPANY_CONSOLE_DEBUG_LOGS)) { \Log::info("Inbound report created for {$this->linkedId}"); } } }