From dd40899c2d3de0d21d7b91f8e5aac12babdd66f6 Mon Sep 17 00:00:00 2001
From: Erick Chandra <erickchandra.1@gmail.com>
Date: Thu, 7 Apr 2016 09:38:08 +0700
Subject: [PATCH] Update renaming with convention for user's NIK.

---
 IES-Bandung/app/Http/Controllers/Auth/AuthController.php    | 4 ++--
 IES-Bandung/app/User.php                                    | 2 +-
 .../migrations/2014_10_12_000000_create_users_table.php     | 2 +-
 .../database/migrations/2016_04_06_020321_user_log.php      | 2 +-
 .../2016_04_06_051454_user_log_after_insert_trigger.php     | 2 +-
 .../2016_04_06_054018_user_log_after_update_trigger.php     | 2 +-
 IES-Bandung/resources/views/auth/register.blade.php         | 6 +++---
 database-sql/db_ies_bandung_core.sql                        | 2 +-
 database-sql/triggers/users_log_AFTER_INSERT_TRIGGER.sql    | 2 +-
 9 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/IES-Bandung/app/Http/Controllers/Auth/AuthController.php b/IES-Bandung/app/Http/Controllers/Auth/AuthController.php
index 6c5d32c..f59c80a 100755
--- a/IES-Bandung/app/Http/Controllers/Auth/AuthController.php
+++ b/IES-Bandung/app/Http/Controllers/Auth/AuthController.php
@@ -54,7 +54,7 @@ class AuthController extends Controller
             'username' => 'required|max:255|unique:users',
             'email' => 'required|email|max:255|unique:users',
             'password' => 'required|min:6|confirmed',
-            'user_nik' => 'required|max:255|unique:users',
+            'nik' => 'required|max:255|unique:users',
             'full_name' => 'required|max:255',
             'birth_date' => 'required|date',
             'birth_place' => 'required|max:255',
@@ -76,7 +76,7 @@ class AuthController extends Controller
                     'username' => $data['username'],
                     'email' => $data['email'],
                     'password' => bcrypt($data['password']),
-                    'user_nik' => $data['user_nik'],
+                    'nik' => $data['nik'],
                     'full_name' => $data['full_name'],
                     'birth_date' => $data['birth_date'],
                     'birth_place' => $data['birth_place'],
diff --git a/IES-Bandung/app/User.php b/IES-Bandung/app/User.php
index 7ff245a..53e3a0b 100755
--- a/IES-Bandung/app/User.php
+++ b/IES-Bandung/app/User.php
@@ -12,7 +12,7 @@ class User extends Authenticatable
      * @var array
      */
     protected $fillable = [
-        'username', 'email', 'password', 'user_nik', 'full_name', 'birth_date', 'birth_place', 'tel_no', 'type'
+        'username', 'email', 'password', 'nik', 'full_name', 'birth_date', 'birth_place', 'tel_no', 'type'
     ];
 
     /**
diff --git a/IES-Bandung/database/migrations/2014_10_12_000000_create_users_table.php b/IES-Bandung/database/migrations/2014_10_12_000000_create_users_table.php
index e0f135e..9c29130 100755
--- a/IES-Bandung/database/migrations/2014_10_12_000000_create_users_table.php
+++ b/IES-Bandung/database/migrations/2014_10_12_000000_create_users_table.php
@@ -17,7 +17,7 @@ class CreateUsersTable extends Migration
             $table->string('username')->unique();
             $table->string('email')->unique();
             $table->string('password');
-            $table->bigInteger('user_nik')->unique();
+            $table->bigInteger('nik')->unique();
             $table->string('full_name');
             $table->date('birth_date');
             $table->string('birth_place');
diff --git a/IES-Bandung/database/migrations/2016_04_06_020321_user_log.php b/IES-Bandung/database/migrations/2016_04_06_020321_user_log.php
index 726de1c..120a9af 100644
--- a/IES-Bandung/database/migrations/2016_04_06_020321_user_log.php
+++ b/IES-Bandung/database/migrations/2016_04_06_020321_user_log.php
@@ -19,7 +19,7 @@ class UserLog extends Migration
             $table->string('email');
             $table->string('old_password')->nullable();
             $table->string('new_password')->nullable();
-            $table->bigInteger('user_nik');
+            $table->bigInteger('nik');
             $table->string('full_name');
             $table->date('birth_date');
             $table->string('birth_place');
diff --git a/IES-Bandung/database/migrations/2016_04_06_051454_user_log_after_insert_trigger.php b/IES-Bandung/database/migrations/2016_04_06_051454_user_log_after_insert_trigger.php
index c8ca713..a1f07fe 100644
--- a/IES-Bandung/database/migrations/2016_04_06_051454_user_log_after_insert_trigger.php
+++ b/IES-Bandung/database/migrations/2016_04_06_051454_user_log_after_insert_trigger.php
@@ -25,7 +25,7 @@ class UserLogAfterInsertTrigger extends Migration
                             email = NEW.email,
                             old_password = NULL,
                             new_password = NEW.password,
-                            user_nik = NEW.user_nik,
+                            nik = NEW.nik,
                             full_name = NEW.full_name,
                             birth_date = NEW.birth_date,
                             birth_place = NEW.birth_place,
diff --git a/IES-Bandung/database/migrations/2016_04_06_054018_user_log_after_update_trigger.php b/IES-Bandung/database/migrations/2016_04_06_054018_user_log_after_update_trigger.php
index 4e2750f..9e94922 100644
--- a/IES-Bandung/database/migrations/2016_04_06_054018_user_log_after_update_trigger.php
+++ b/IES-Bandung/database/migrations/2016_04_06_054018_user_log_after_update_trigger.php
@@ -25,7 +25,7 @@ class UserLogAfterUpdateTrigger extends Migration
                             email = NEW.email,
                             old_password = OLD.password,
                             new_password = NEW.password,
-                            user_nik = NEW.user_nik,
+                            nik = NEW.nik,
                             full_name = NEW.full_name,
                             birth_date = NEW.birth_date,
                             birth_place = NEW.birth_place,
diff --git a/IES-Bandung/resources/views/auth/register.blade.php b/IES-Bandung/resources/views/auth/register.blade.php
index cd814fd..9970995 100755
--- a/IES-Bandung/resources/views/auth/register.blade.php
+++ b/IES-Bandung/resources/views/auth/register.blade.php
@@ -80,10 +80,10 @@
                             <div class="col-lg-6">
 
                                 <div class="form-group">
-                                    <input type="text" placeholder="Nomor KTP (NIK)" class="form-control" name="user_nik" value="{{ old('user_nik') }}" required>
-                                    @if ($errors->has('user_nik'))
+                                    <input type="text" placeholder="Nomor KTP (NIK)" class="form-control" name="nik" value="{{ old('nik') }}" required>
+                                    @if ($errors->has('nik'))
                                         <span class="help-block">
-                                            <strong>{{ $errors->first('user_nik') }}</strong>
+                                            <strong>{{ $errors->first('nik') }}</strong>
                                         </span>
                                     @endif
                                 </div>
diff --git a/database-sql/db_ies_bandung_core.sql b/database-sql/db_ies_bandung_core.sql
index 160c86e..4021619 100755
--- a/database-sql/db_ies_bandung_core.sql
+++ b/database-sql/db_ies_bandung_core.sql
@@ -9,7 +9,7 @@ USE db_ies_bandung_core;
 -- Table structure for table `User`
 CREATE TABLE `User` (
 	`userID` INTEGER(10) NOT NULL AUTO_INCREMENT,
-	`user_nik` INTEGER(20) NOT NULL,
+	`nik` INTEGER(20) NOT NULL,
 	`username` VARCHAR(255) NOT NULL,
 	`full_name` VARCHAR(255) NOT NULL,
 	`birth_date` DATE NOT NULL,
diff --git a/database-sql/triggers/users_log_AFTER_INSERT_TRIGGER.sql b/database-sql/triggers/users_log_AFTER_INSERT_TRIGGER.sql
index a95a3a2..de9dabf 100644
--- a/database-sql/triggers/users_log_AFTER_INSERT_TRIGGER.sql
+++ b/database-sql/triggers/users_log_AFTER_INSERT_TRIGGER.sql
@@ -10,7 +10,7 @@ CREATE TRIGGER users_log_AFTER_INSERT_TRIGGER
 			email = NEW.email,
 			NEW_password = NULL,
 			new_password = NEW.password,
-			user_nik = NEW.user_nik,
+			nik = NEW.nik,
 			full_name = NEW.full_name,
 			birth_date = NEW.birth_date,
 			birth_place = NEW.birth_place,
-- 
GitLab