with(['rule', 'run']) ->when($request->filled('resolved'), function ($query) use ($request): void { $query->where('is_resolved', (bool) $request->boolean('resolved')); }) ->latest('id') ->paginate(20) ->withQueryString(); return view('admin.crawl-alerts.index', [ 'items' => $items, 'filters' => $request->only(['resolved']), ]); } public function resolve(CrawlAlert $alert): RedirectResponse { $alert->is_resolved = true; $alert->resolved_at = now(); $alert->resolved_by = null; $alert->save(); return redirect()->back()->with('status', '告警已标记为已处理'); } }