with('rule') ->when($request->filled('rule_id'), function ($query) use ($request): void { $query->where('rule_id', (int) $request->input('rule_id')); }) ->latest('id') ->paginate(20) ->withQueryString(); return view('admin.crawl-runs.index', [ 'items' => $items, 'filters' => $request->only(['rule_id']), ]); } public function show(CrawlRun $run): View { $run->load(['rule', 'items' => function ($query): void { $query->latest('id'); }, 'alerts']); return view('admin.crawl-runs.show', [ 'run' => $run, ]); } public function retry(CrawlRun $run): RedirectResponse { if ($run->rule_id !== null) { RunCrawlRuleJob::dispatch($run->rule_id, 'retry', null, $run->id); } return redirect()->route('admin.crawl-runs.index', ['rule_id' => $run->rule_id]) ->with('status', '已提交重试任务'); } }