[]]], parameters: [ new OA\Parameter(name: 'is_approved', in: 'query', required: false, schema: new OA\Schema(type: 'boolean')), new OA\Parameter(name: 'commentable_type', in: 'query', required: false, schema: new OA\Schema(type: 'string')), new OA\Parameter(name: 'search', in: 'query', required: false, schema: new OA\Schema(type: 'string')), new OA\Parameter(name: 'per_page', in: 'query', required: false, schema: new OA\Schema(type: 'integer', default: 15)), ], responses: [new OA\Response(response: 200, description: 'Yorum listesi')], )] public function index(Request $request): AnonymousResourceCollection { $comments = $this->repository->paginate( $request->only(['is_approved', 'commentable_type', 'search']), $request->integer('per_page', 15), ); return CommentResource::collection($comments); } #[OA\Get( path: '/api/admin/comments/{comment}', summary: 'Yorum detayı', tags: ['Admin - Comments'], security: [['sanctum' => []]], parameters: [new OA\Parameter(name: 'comment', in: 'path', required: true, schema: new OA\Schema(type: 'integer'))], responses: [new OA\Response(response: 200, description: 'Yorum detayı')], )] public function show(Comment $comment): JsonResponse { return response()->json(new CommentResource($comment)); } #[OA\Put( path: '/api/admin/comments/{comment}', summary: 'Yorum güncelle (onayla/reddet)', tags: ['Admin - Comments'], security: [['sanctum' => []]], parameters: [new OA\Parameter(name: 'comment', in: 'path', required: true, schema: new OA\Schema(type: 'integer'))], requestBody: new OA\RequestBody(required: true, content: new OA\JsonContent( properties: [ new OA\Property(property: 'is_approved', type: 'boolean'), ], )), responses: [ new OA\Response(response: 200, description: 'Yorum güncellendi'), new OA\Response(response: 422, description: 'Validasyon hatası'), ], )] public function update(UpdateCommentRequest $request, Comment $comment, UpdateCommentAction $action): JsonResponse { $comment = $action->execute($comment, $request->validated()); return response()->json(new CommentResource($comment)); } #[OA\Delete( path: '/api/admin/comments/{comment}', summary: 'Yorum sil', tags: ['Admin - Comments'], security: [['sanctum' => []]], parameters: [new OA\Parameter(name: 'comment', in: 'path', required: true, schema: new OA\Schema(type: 'integer'))], responses: [new OA\Response(response: 200, description: 'Yorum silindi')], )] public function destroy(Comment $comment, DeleteCommentAction $action): JsonResponse { $action->execute($comment); return response()->json(['message' => 'Yorum silindi.']); } }