diff --git a/Modules/Internal/Http/Controllers/Api/OrganizationController.php b/Modules/Internal/Http/Controllers/Api/OrganizationController.php index 67ff2ff4..852ee18c 100644 --- a/Modules/Internal/Http/Controllers/Api/OrganizationController.php +++ b/Modules/Internal/Http/Controllers/Api/OrganizationController.php @@ -136,11 +136,11 @@ class OrganizationController extends Controller ]); } - $update_organization->addresses()->updateOrCreate([ + $newAddres = $update_organization->addresses()->updateOrCreate([ 'id' => $update_organization->main_address_id ], [ 'use' => 'both', - 'type' => 'physical', + 'type' => 'hospital', 'text' => $request->address, 'province_id' => $request->province_id, 'city_id' => $request->city_id, @@ -150,6 +150,10 @@ class OrganizationController extends Controller 'lat' => $request->lat, 'lng' => $request->lng, ]); + + $update_organization->main_address_id = $newAddres->id; + $update_organization->save(); + return response()->json([ 'message' => 'Data berhasil diubah',