', 0) ->whereNotNull('webhook_url') ->orderBy('updated_at', 'desc') ->paginate(20); $response = [ 'jobs' => $jobs->items(), 'pagination' => [ 'current_page' => $jobs->currentPage(), 'total_pages' => $jobs->lastPage(), 'total_items' => $jobs->total(), 'per_page' => $jobs->perPage() ] ]; return response()->json($response); } public function retry(string $uuid): JsonResponse { $job = CrawlShotJob::where('uuid', $uuid)->first(); if (!$job) { return response()->json(['error' => 'Job not found'], 404); } if (!$job->webhook_url) { return response()->json(['error' => 'Job has no webhook URL'], 400); } // Attempt webhook immediately WebhookService::send($job); return response()->json([ 'uuid' => $job->uuid, 'message' => 'Webhook retry attempted' ]); } public function clear(string $uuid): JsonResponse { $job = CrawlShotJob::where('uuid', $uuid)->first(); if (!$job) { return response()->json(['error' => 'Job not found'], 404); } $job->update([ 'webhook_attempts' => 0, 'webhook_last_error' => null, 'webhook_next_retry_at' => null ]); return response()->json([ 'uuid' => $job->uuid, 'message' => 'Webhook error cleared' ]); } }