repository->paginate( $request->only(['category', 'featured', 'search', 'sort']), $request->integer('per_page', 15), ); return AnnouncementResource::collection($announcements); } #[OA\Get( path: '/api/v1/announcements/{slug}', summary: 'Duyuru detayı', tags: ['Announcements'], parameters: [new OA\Parameter(name: 'slug', in: 'path', required: true, schema: new OA\Schema(type: 'string'))], responses: [ new OA\Response(response: 200, description: 'Duyuru detayı'), new OA\Response(response: 404, description: 'Duyuru bulunamadı'), ], )] public function show(string $slug): JsonResponse { $announcement = $this->repository->findBySlug($slug); if (! $announcement) { return response()->json(['message' => 'Duyuru bulunamadı.'], 404); } $announcement->load(['comments' => fn ($q) => $q->where('is_approved', true)->latest()]); return response()->json(new AnnouncementResource($announcement)); } }