user() ->sites() ->withCount(['uptimeChecks', 'sslCertificates', 'brokenLinks']) ->orderBy('created_at', 'desc') ->get(); return response()->json([ 'data' => $sites, ]); } /** * Get a specific site for the authenticated user. */ public function show(Request $request, Site $site): JsonResponse { // Ensure the site belongs to the authenticated user if ($site->user_id !== $request->user()->id) { return response()->json([ 'message' => 'Unauthorized', ], 403); } $site->loadCount(['uptimeChecks', 'sslCertificates', 'brokenLinks']); return response()->json([ 'data' => $site, ]); } }