diff --git a/app/Education.php b/app/Education.php
index 4e751a38c654941cca0ee26bddbdded475fea5f6..a4bbf9a94fcf042bdac959340f8472d79a2c6adb 100644
--- a/app/Education.php
+++ b/app/Education.php
@@ -13,5 +13,5 @@ class Education extends Model
     	'major',
     	'start_year',
     	'end_year'
-    ]
+    ];
 }
diff --git a/app/Employment.php b/app/Employment.php
index 2308e331b9520e905c34878b07e50650c3dede42..9d659f9ba893332879fab4c72a6968b4404bee15 100644
--- a/app/Employment.php
+++ b/app/Employment.php
@@ -13,5 +13,5 @@ class Employment extends Model
     	'position',
     	'start_year',
     	'end_year'
-    ]
+    ];
 }
diff --git a/app/Experience.php b/app/Experience.php
index 9a3ca5f9a341d2646fa922aeb5cd3aea0a1eb2e6..8ac170c808f20d59948ef1f0f3865dcfa4e7f432 100644
--- a/app/Experience.php
+++ b/app/Experience.php
@@ -12,5 +12,5 @@ class Experience extends Model
     	'position',
     	'start_year',
     	'end_year'
-    ]
+    ];
 }
diff --git a/app/Http/Controllers/Profile/ProfileAPIController.php b/app/Http/Controllers/Profile/ProfileAPIController.php
index ab60fd76141f9b650ad4924e9fc8734746352e37..feaf4bfc892a9c6a919d27a8012bb81a5a5f6de8 100644
--- a/app/Http/Controllers/Profile/ProfileAPIController.php
+++ b/app/Http/Controllers/Profile/ProfileAPIController.php
@@ -11,7 +11,9 @@ use App\Employment;
 use App\Experience;
 use App\Performance;
 use App\Profile;
+use App\User;
 use Validator;
+use Illuminate\Support\Facades\Hash;
 
 
 class ProfileAPIController extends APIBaseController
@@ -41,21 +43,39 @@ class ProfileAPIController extends APIBaseController
 
         $validator = Validator::make($input, [
             'name' => 'required',
+            'email' => 'required',
+            'password' => 'required',
             'nip' => 'required',
             'birth_place' => 'required',
-            'birth_date' => 'required'
+            'birth_date' => 'required',
         ]);
 
-
         if($validator->fails()){
             return $this->sendError('Validation Error.', $validator->errors());       
         }
 
+        $find = User::where('email', $input['email'])->count();
 
-        $post = Profile::create($input);
+        if($find != 0){
+            return $this->sendError('Email Already Exist');
+        }
 
+        $postUser = User::create([
+            'name' => $input['name'],
+            'email' => $input['email'],
+            'password' => Hash::make($input['password']),
+        ]);
 
-        return $this->sendResponse($post->toArray(), 'Profile created successfully.');
+        $postProfile = Profile::create([
+            'name' => $input['name'],
+            'nip' => $input['nip'],
+            'birth_place' => $input['birth_place'],
+            'birth_date' => $input['birth_date'],
+        ]);
+
+        $post = array_merge($postUser->toArray(), $postProfile->toArray());
+
+        return $this->sendResponse($post, 'User created successfully.');
     }
 
 
@@ -90,34 +110,129 @@ class ProfileAPIController extends APIBaseController
     {
         $input = $request->all();
 
-
         $validator = Validator::make($input, [
             'name' => 'required',
+            'email' => 'required',
+            'password' => 'required',
             'nip' => 'required',
-            'birth_place' => 'required',
-            'birth_date' => 'required',
         ]);
 
-
         if($validator->fails()){
             return $this->sendError('Validation Error.', $validator->errors());       
         }
+        
+        $post = User::find($id);
 
-
-        $post = Profile::find($id);
         if (is_null($post)) {
             return $this->sendError('Profile not found.');
         }
 
+        $user = User::find($id);
+        $profile = Profile::find($id);
+
+        if(!is_null($input['name'])){
+            $user->name = $input['name'];
+            $profile->name = $input['name'];
+        }
+
+        if(!is_null($input['email'])){
+            $user->email = $input['email'];
+        }
+
+        if(!is_null($input['password'])){
+            $user->password = Hash::make($input['password']);
+        }
+
+        if(!is_null($input['nip'])){
+            $profile->nip = $input['nip'];
+        }
+
+        if(!is_null($input['birth_place'])){
+            $profile->birth_place = $input['birth_place'];
+        }
+
+        if(!is_null($input['birth_date'])){
+            $profile->birth_date = $input['birth_date'];
+        }
+
+        $performance = Performance::where('user_id', $user->id);
 
-        $post->name = $input['name'];
-        $post->nip = $input['nip'];
-        $post->birth_place = $input['birth_place'];
-        $post->birth_date = $input['birth_date'];
-        $post->save();
+        if($performance->count() > 0){
+            $performance->delete();
+        }
+
+        for($i = 1; $i <= $input['performance_counter']; $i++){
+            $postPerformance = Performance::create([
+                'user_id' => $user->id,
+                'date' => $input['performance_date_' . $i],
+                'purpose' => $input['performance_purpose_' . $i],
+                'performance_report' => $input['performance_report_' . $i],
+            ]);
+        }
+
+        $education = Education::where('user_id', $user->id);
+
+        if($education->count() > 0){
+            $education->delete();
+        }
+
+        for($i = 1; $i <= $input['education_counter']; $i++){
+            $postEducation = Education::create([
+                'user_id' => $user->id,
+                'degree' => $input['education_degree_' . $i],
+                'institution' => $input['education_institution_' . $i],
+                'major' => $input['education_major_' . $i],
+                'start_year' => $input['education_start_year_' . $i],
+                'end_year' => $input['education_end_year_' . $i],
+            ]);
+        }
 
+        $employment = Employment::where('user_id', $user->id);
 
-        return $this->sendResponse($post->toArray(), 'Profile updated successfully.');
+        if($employment->count() > 0){
+            $employment->delete();
+        }
+
+        for($i = 1; $i <= $input['employment_counter']; $i++){
+            $postEmployment = Employment::create([
+                'user_id' => $user->id,
+                'competency' => $input['employment_competency_' . $i],
+                'unit' => $input['employment_unit_' . $i],
+                'position' => $input['employment_position_' . $i],
+                'start_year' => $input['employment_start_year_' . $i],
+                'end_year' => $input['employment_end_year_' . $i],
+            ]);
+        }
+
+        $experience = Experience::where('user_id', $user->id);
+
+        if($experience->count() > 0){
+            $experience->delete();
+        }
+
+        for($i = 1; $i <= $input['experience_counter']; $i++){
+            $postExperience = Experience::create([
+                'user_id' => $user->id,
+                'institution' => $input['experience_institution_' . $i],
+                'position' => $input['experience_position_' . $i],
+                'start_year' => $input['experience_start_year_' . $i],
+                'end_year' => $input['experience_end_year_' . $i],
+            ]);
+        }
+
+        $user->save();
+        $profile->save();
+
+        $data = array_merge(
+            $user->toArray(),
+            $profile->toArray(),
+            $performance->get()->toArray(),
+            $education->get()->toArray(),
+            $employment->get()->toArray(),
+            $experience->get()->toArray()
+        );
+
+        return $this->sendResponse($data, 'Profile updated successfully.');
     }
 
 
@@ -129,15 +244,50 @@ class ProfileAPIController extends APIBaseController
      */
     public function destroy($id)
     {
-        $post = Profile::find($id);
+        $user = User::find($id);
+
+        if (is_null($user)) {
+            return $this->sendError('Profile not found.');
+        }
 
+        $user->delete();
 
-        if (is_null($post)) {
+
+        $profile = Profile::find($id);
+
+        if (is_null($profile)) {
             return $this->sendError('Profile not found.');
         }
 
+        $profile->delete();
+
+
+        $performance = Performance::where('user_id', $user->id);
+
+        if($performance->count() > 0){
+            $performance->delete();
+        }
+
+
+        $education = Education::where('user_id', $user->id);
+
+        if($education->count() > 0){
+            $education->delete();
+        }
+
+
+        $employment = Employment::where('user_id', $user->id);
+
+        if($employment->count() > 0){
+            $employment->delete();
+        }
+
 
-        $post->delete();
+        $experience = Experience::where('user_id', $user->id);
+
+        if($experience->count() > 0){
+            $experience->delete();
+        }
 
 
         return $this->sendResponse($id, 'Tag deleted successfully.');
diff --git a/app/Performance.php b/app/Performance.php
index fa404b4f9c168a99e725494ce2501065c323cdf0..c2f9991263a7af019c60f3592cf0d1c900bd5ab2 100644
--- a/app/Performance.php
+++ b/app/Performance.php
@@ -11,5 +11,5 @@ class Performance extends Model
     	'date',
     	'purpose',
     	'performance_report'
-    ]
+    ];
 }
diff --git a/database/migrations/2018_04_05_034810_create_profiles_table.php b/database/migrations/2018_04_05_034810_create_profiles_table.php
index 0b66ed9359695a521c2849a29c21494d9ff572e7..8b3a1c9ad462ee8d3b3490193108229f930dc57d 100644
--- a/database/migrations/2018_04_05_034810_create_profiles_table.php
+++ b/database/migrations/2018_04_05_034810_create_profiles_table.php
@@ -14,7 +14,7 @@ class CreateProfilesTable extends Migration
     public function up()
     {
         Schema::create('profiles', function (Blueprint $table) {
-            $table->increments('user_id');
+            $table->increments('id');
             $table->string('name', 200);
             $table->string('nip', 200);
             $table->string('birth_place', 200);
diff --git a/database/migrations/2018_04_07_004142_create_performances_table.php b/database/migrations/2018_04_07_004142_create_performances_table.php
index 82790c293f06ca055601e7284a075bf99bef65a5..4188bf2e147022b646a3f5aad547899b6b70fe61 100644
--- a/database/migrations/2018_04_07_004142_create_performances_table.php
+++ b/database/migrations/2018_04_07_004142_create_performances_table.php
@@ -18,7 +18,7 @@ class CreatePerformancesTable extends Migration
             $table->integer('user_id');
             $table->string('date', 200);
             $table->string('purpose', 250);
-            $table->string('performace_report', 300);
+            $table->string('performance_report', 300);
             $table->timestamps();
         });
     }
diff --git a/database/migrations/2018_04_07_014150_create_education_table.php b/database/migrations/2018_04_07_014150_create_education_table.php
index 9507dc722414eece143db6a91552d25e96004b24..5e8ef80a4d4e76983eafbb5fb9ad45ddc5111498 100644
--- a/database/migrations/2018_04_07_014150_create_education_table.php
+++ b/database/migrations/2018_04_07_014150_create_education_table.php
@@ -18,8 +18,8 @@ class CreateEducationTable extends Migration
             $table->string('degree', 200);
             $table->string('institution', 200);
             $table->string('major', 200);
-            $table->string('start_date', 200);
-            $table->string('end_date', 200);
+            $table->string('start_year', 200);
+            $table->string('end_year', 200);
             $table->timestamps();
         });
     }