[]]], tags: ['Profile'], responses: [ new OA\Response( response: 200, description: 'Profile fetched successfully', content: new OA\JsonContent( properties: [ new OA\Property(property: 'message', type: 'string', example: 'اطلاعات پروفایل با موفقیت دریافت شد.'), new OA\Property( property: 'data', properties: [ new OA\Property(property: 'user', ref: '#/components/schemas/User'), ], type: 'object' ), ] ) ), new OA\Response(response: 401, description: 'Unauthenticated'), ] )] public function show(): JsonResponse { return $this->success('اطلاعات پروفایل با موفقیت دریافت شد.', [ 'user' => new UserResource(request()->user()), ]); } #[OA\Put( path: '/profile', description: 'Update the authenticated user profile', summary: 'Update profile', security: [['sanctum' => []]], tags: ['Profile'], requestBody: new OA\RequestBody( required: true, content: new OA\JsonContent( properties: [ new OA\Property(property: 'name', type: 'string', example: 'علی رضایی'), new OA\Property(property: 'username', type: 'string', example: 'ali'), new OA\Property(property: 'email', type: 'string', format: 'email', example: 'ali@example.com'), new OA\Property(property: 'mobile', type: 'string', example: '09123456789'), new OA\Property(property: 'password', type: 'string', format: 'password', example: 'password123'), ] ) ), responses: [ new OA\Response( response: 200, description: 'Profile updated successfully', content: new OA\JsonContent( properties: [ new OA\Property(property: 'message', type: 'string', example: 'پروفایل با موفقیت به‌روزرسانی شد.'), new OA\Property( property: 'data', properties: [ new OA\Property(property: 'user', ref: '#/components/schemas/User'), ], type: 'object' ), ] ) ), new OA\Response(response: 401, description: 'Unauthenticated'), new OA\Response(response: 422, description: 'Validation error'), ] )] public function update(UpdateProfileRequest $request): JsonResponse { $user = $request->user(); $user->update($request->validated()); return $this->success('پروفایل با موفقیت به‌روزرسانی شد.', [ 'user' => new UserResource($user->fresh()), ]); } }