# Form-data not Updating the data in DB but raw json works

**URL:** <https://community.postman.com/t/form-data-not-updating-the-data-in-db-but-raw-json-works/81622>\
**Category:** Help Hub\
**Tags:** tests, json, form-data\
**Created:** [June 27, 2025, 4:20pm UTC](https://community.postman.com/t/form-data-not-updating-the-data-in-db-but-raw-json-works/81622 "2025-06-27T16:20:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asadali28032](https://avatars.discourse-cdn.com/v4/letter/a/49beb7/32.png) [@asadali28032](https://community.postman.com/u/asadali28032)\
**Post date:** [June 27, 2025, 4:20pm UTC](https://community.postman.com/t/form-data-not-updating-the-data-in-db-but-raw-json-works/81622/1 "2025-06-27T16:20:37Z")

</div>

when i use ‘Post or Patch/Put’ for raw json it works fine, but when use form-data ‘Post’ only works and ‘Put/Patch’ doesn’t work.although it shows success:true .

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [June 27, 2025, 6:18pm UTC](https://community.postman.com/t/form-data-not-updating-the-data-in-db-but-raw-json-works/81622/2 "2025-06-27T18:18:22Z")

</div>

Hey @asadali28032 👋🏻

Without more context of the API you’re using and the expected structure for those methods, it’s tough to give any type of advice here.

What do you mean by doesn’t work? An error? A message returned from the server? Something else?

Please include links to any public documentation and share some visual examples for you’re seeing.

---

<div class="post-metadata">

**Author:** ![docking-module-expl5](https://avatars.discourse-cdn.com/v4/letter/d/5daacb/32.png) [@docking-module-expl5](https://community.postman.com/u/docking-module-expl5)\
**Post date:** [June 28, 2025, 4:09am UTC](https://community.postman.com/t/form-data-not-updating-the-data-in-db-but-raw-json-works/81622/3 "2025-06-28T04:09:26Z")

</div>

@asadali28032 you are right i am having this issue for a year now i started using ‘POST’ for edit as well

@danny-dainton look at the code i have

**route file**

```auto
	Route::put('/makeVisitorDecision', [NotificationController::class, 'makeVisitorDecision']);

```

**controller file**

```auto
public function makeVisitorDecision(Request $request)
    {
        try {
            
            $request->validate([
                'visitor_id' => 'required|integer',
                'action' => 'required|in:approve,reject',
            ]);

            $visitor = VisitorHistory::find($request->visitor_id);

            if (!$visitor) {
                return response()->json([
                    'msg' => 'Visitor not found'
                ], 404);
            }
            if ($visitor->status !== 'Pending') {
                return response()->json([
                    'msg' => 'Visitor is not in a state to be approved or rejected'
                ], 422);
            }

            $visitor->status = $request->action === 'approve' ? 'UserApproved' : 'UserRejected';
            $visitor->save();

            return response()->json([
                'msg' => $request->action === 'approve' ? 'Visitor approved' : 'Visitor rejected'
            ]);
            
        } catch (\Throwable $th) {
            return response()->json([
                'msg' => $th->getMessage()
            ]);
        }
    }

```
