diff --git a/app/Http/Controllers/DataPegawaiController.php b/app/Http/Controllers/DataPegawaiController.php
index ceef77dff9fbb505767730b6c181b909503d4488..cf4215a90b6e2e9fe06428485e61e7461cfc5161 100644
--- a/app/Http/Controllers/DataPegawaiController.php
+++ b/app/Http/Controllers/DataPegawaiController.php
@@ -4,6 +4,8 @@ namespace App\Http\Controllers;
 
 use App\DenormalizedPegawai;
 use Illuminate\Http\Request;
+use App\Http\Controllers\APIBaseController as APIBaseController;
+use App\DataKepegawaian;
 
 class DataPegawaiController extends APIBaseController
 {
@@ -70,8 +72,6 @@ class DataPegawaiController extends APIBaseController
      */
     public function update(Request $request, $id)
     {
-        $input = $request->all();
-
         
     }
 
diff --git a/app/Http/Controllers/KepegawaianController.php b/app/Http/Controllers/KepegawaianController.php
new file mode 100644
index 0000000000000000000000000000000000000000..904ba1e45b58e7ec61d8fba93f3019a6eabc7995
--- /dev/null
+++ b/app/Http/Controllers/KepegawaianController.php
@@ -0,0 +1,50 @@
+<?php
+
+namespace App\Http\Controllers;
+
+use Illuminate\Http\Request;
+use App\Http\Controllers\APIBaseController as APIBaseController;
+use App\DataKepegawaian;
+use App\Pegawai;
+
+class KepegawaianController extends APIBaseController
+{
+    public function update(Request $request, $id)
+    {
+        $input = $request->all();
+
+        $list = array();
+
+        for ($i = 0; $i < count($input['kepegawaian']); $i++) {
+
+            $kepegawaian = DataKepegawaian::find($input['kepegawaian'][$i]['id_data_kepegawaian']);
+
+            if(is_null($kepegawaian)){
+            	$postDataKepegawaian = DataKepegawaian::create([
+	                'id_pegawai' => $id,
+	                'id_posisi' => $input['kepegawaian'][$i]['id_posisi'],
+	                'id_unit_kerja' => $input['kepegawaian'][$i]['id_unit_kerja'],
+	                'tahun_masuk' => $input['kepegawaian'][$i]['tahun_masuk'],
+	                'tahun_keluar' => $input['kepegawaian'][$i]['tahun_keluar'],
+            	]);
+        		array_push($list, $postDataKepegawaian->id_data_kepegawaian);
+            }else{
+	            $kepegawaian->id_pegawai = $input['kepegawaian'][$i]['id_pegawai'];
+	            $kepegawaian->id_posisi = $input['kepegawaian'][$i]['id_posisi'];
+	            $kepegawaian->id_unit_kerja = $input['kepegawaian'][$i]['id_unit_kerja'];
+	            $kepegawaian->tahun_masuk = $input['kepegawaian'][$i]['tahun_masuk'];
+	            $kepegawaian->tahun_keluar = $input['kepegawaian'][$i]['tahun_keluar'];
+
+	            $kepegawaian->save();
+	            array_push($list, $input['kepegawaian'][$i]['id_data_kepegawaian']);
+            }
+            
+        }
+
+        $data = DataKepegawaian::where('id_pegawai',$id)->whereNotIn('id_data_kepegawaian', $list);
+        $data->delete();
+
+        return $this->sendResponse($input, 'Kepegawaian updated successfully.');
+
+    }
+}
diff --git a/app/Http/Controllers/RiwayatController.php b/app/Http/Controllers/RiwayatController.php
index 1435b894ad84db887181973b0971999c6ff338dc..f9a39080edb56b04cdc6251b2a189924bab3fcf7 100644
--- a/app/Http/Controllers/RiwayatController.php
+++ b/app/Http/Controllers/RiwayatController.php
@@ -3,6 +3,7 @@
 namespace App\Http\Controllers;
 
 use Illuminate\Http\Request;
+use App\Http\Controllers\APIBaseController as APIBaseController;
 use App\RiwayatPekerjaan;
 use App\RiwayatPendidikan;
 
@@ -41,6 +42,6 @@ class RiwayatController extends APIBaseController
             
         }
 
-        return $this->sendResponse($input, 'Riwayat Pendidikan & Pekerjaan created successfully.');
+        return $this->sendResponse($input, 'Riwayat Pendidikan & Pekerjaan updated successfully.');
     }
 }
diff --git a/app/Http/Controllers/SertifikatController.php b/app/Http/Controllers/SertifikatController.php
index 83917cff5452c551f7c612339416895075a03d60..39149e4cb8f87b5b9c890ff26fa69c1520bd2d82 100644
--- a/app/Http/Controllers/SertifikatController.php
+++ b/app/Http/Controllers/SertifikatController.php
@@ -48,6 +48,6 @@ class SertifikatController extends APIBaseController
             $sertifikat->save();
         }
 
-        return $this->sendResponse($input, 'Sertifikat created successfully.');
+        return $this->sendResponse($input, 'Sertifikat updated successfully.');
     }
 }
diff --git a/public/js/profile.js b/public/js/profile.js
index b0e509a54bd5263663e5f6dcc4d09d2ceaf7076f..b04f4235f955facb5e3b5519a347a06b18696147 100644
--- a/public/js/profile.js
+++ b/public/js/profile.js
@@ -15367,17 +15367,15 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
 
             console.log(this.dataKepegawaian);
 
-            // axios.post('/api/kepegawaian/' + this.id, {
-            //     kepegawaian: this.dataKepegawaian,
-            //     _method: 'put'
-            // })
-            // .then(function (response) {
-            //     console.log(response);
-            //     window.location.href = "/pages/profile";
-            // })
-            // .catch(function (error) {
-            //     alert(error);
-            // });
+            axios.post('/api/kepegawaian/' + this.id, {
+                kepegawaian: this.dataKepegawaian,
+                _method: 'put'
+            }).then(function (response) {
+                console.log(response);
+                window.location.href = "/pages/profile";
+            }).catch(function (error) {
+                alert(error);
+            });
         },
         saveRiwayatPegawai: function saveRiwayatPegawai() {
             //sort
diff --git a/resources/assets/js/components/ProfilPegawai.vue b/resources/assets/js/components/ProfilPegawai.vue
index e5ab6082a241152377ddf868d12c67b9bcf592c6..3b95cbc5c9396d430ccc07958890aa503beb3cf2 100644
--- a/resources/assets/js/components/ProfilPegawai.vue
+++ b/resources/assets/js/components/ProfilPegawai.vue
@@ -1272,17 +1272,17 @@
 
                 console.log(this.dataKepegawaian);
 
-                // axios.post('/api/kepegawaian/' + this.id, {
-                //     kepegawaian: this.dataKepegawaian,
-                //     _method: 'put'
-                // })
-                // .then(function (response) {
-                //     console.log(response);
-                //     window.location.href = "/pages/profile";
-                // })
-                // .catch(function (error) {
-                //     alert(error);
-                // });
+                axios.post('/api/kepegawaian/' + this.id, {
+                    kepegawaian: this.dataKepegawaian,
+                    _method: 'put'
+                })
+                .then(function (response) {
+                    console.log(response);
+                    window.location.href = "/pages/profile";
+                })
+                .catch(function (error) {
+                    alert(error);
+                });
             },
 
             saveRiwayatPegawai() {
diff --git a/routes/api.php b/routes/api.php
index b46f87973f767e155b37949a8a145b25e06a8194..82f4cb66dffd262edd40fb04baf06b79fb41fdc7 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -37,9 +37,9 @@ Route::post('kinerja/import', 'DataKinerjaController@import');
 
 Route::resource('kinerja', 'DataKinerjaController');
 
-Route::resource('pegawai-denormalized', 'DataPegawaiController@index');
+Route::resource('pegawai-denormalized', 'DataPegawaiController');
 
-Route::resource('kepegawaian', 'DataPegawaiController@update');
+Route::resource('kepegawaian', 'KepegawaianController');
 
 Route::resource('riwayat', 'RiwayatController');