diff --git a/app/AuditCustomer.php b/app/AuditCustomer.php index b86564b..f32ee6c 100644 --- a/app/AuditCustomer.php +++ b/app/AuditCustomer.php @@ -14,10 +14,12 @@ class AuditCustomer extends Model 'username', 'old_data', 'new_data', + 'kodkerja', + 'nota_pekerjaan', 'kodcaw', 'created_at', 'updated_at', 'customer_name', 'customer_nokp', ]; -} \ No newline at end of file +} diff --git a/app/Customer.php b/app/Customer.php index 2e9257b..deaa404 100644 --- a/app/Customer.php +++ b/app/Customer.php @@ -60,6 +60,7 @@ class Customer extends Model 'tagperingatan', 'kumpulan', 'telefon2', + 'nota_pekerjaan', 'tagpelanggan' ]; diff --git a/app/Http/Controllers/CustomerController.php b/app/Http/Controllers/CustomerController.php index 55bc4ba..0f6f6a5 100644 --- a/app/Http/Controllers/CustomerController.php +++ b/app/Http/Controllers/CustomerController.php @@ -345,6 +345,7 @@ class CustomerController extends Controller 'nosiri'=>$request->nosiri, 'nota'=>$request->nota, 'kodkerja'=>$request->kodkerja, + 'nota_pekerjaan'=>$request->nota_pekerjaan, 'tujuangadai'=>$request->tujuangadai ]); @@ -362,6 +363,8 @@ class CustomerController extends Controller 'poskod' => $request->poskod, 'koddaerah' => $poskod['koddaerah'], 'kodnegeri' => $poskod['kodnegeri'], + 'kodkerja'=>$request->kodkerja, + 'nota_pekerjaan'=>$request->nota_pekerjaan, 'telefon' => $request->telefon1, 'telefon2' => $request->telefon2 )); @@ -377,7 +380,7 @@ class CustomerController extends Controller $poskod = Poskod::on('mysql7')->where('poskod','=',$request->poskod)->first(); $customer_info = DB::connection('mysql7')->table('customer') - ->select('kodcaw','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2') + ->select('kodcaw','kodkerja','nota_pekerjaan','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2') ->where('kplama','=',$nokp) ->orWhere('kpbaru','=',$nokp) ->get()->toArray(); @@ -392,6 +395,9 @@ class CustomerController extends Controller 'telefon' => $request->telefon1, 'telefon2' => $request->telefon2, 'kodbank' => $request->kodbank, + 'kodkerja' => $request->kodkerja, + // 'nota_pekerjaan' => $request->nota_pekerjaan, + 'nota_pekerjaan' => $request->kodkerja === '6' ? $request->nota_pekerjaan : null, 'noakaun' => $request->noakaun, 'nota' => $request->nota, 'alamat1' => $request->alamat, @@ -403,7 +409,7 @@ class CustomerController extends Controller if($customer_update) { $customer_info_new = DB::connection('mysql7')->table('customer') - ->select('kodcaw','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2') + ->select('kodcaw','kodkerja','nota_pekerjaan','tarikhdaftar','nopelanggan','kpbaru','kplama','nama','t_lahir','jantina','alamat1','poskod','telefon','telefon2') ->where('kplama','=',$nokp) ->orWhere('kpbaru','=',$nokp) ->get()->toArray(); @@ -458,6 +464,8 @@ class CustomerController extends Controller 'telefon' => $request->telefon1, 'telefon2' => $request->telefon2, 'kodbank' => $request->kodbank, + 'kodkerja' => $request->kodkerja, + 'nota_pekerjaan' => $request->nota_pekerjaan, 'noakaun' => $request->noakaun, 'nota' => $request->nota, 'nama' => $request->nama, diff --git a/app/Http/Controllers/PekerjaanController.php b/app/Http/Controllers/PekerjaanController.php index 6f268f7..870e56b 100644 --- a/app/Http/Controllers/PekerjaanController.php +++ b/app/Http/Controllers/PekerjaanController.php @@ -12,4 +12,4 @@ class PekerjaanController extends Controller return response()->json($kerja); } -} \ No newline at end of file +} diff --git a/database/migrations/2024_11_25_154933_add_nota-pekerjaan.php b/database/migrations/2024_11_25_154933_add_nota-pekerjaan.php new file mode 100644 index 0000000..20f0cc3 --- /dev/null +++ b/database/migrations/2024_11_25_154933_add_nota-pekerjaan.php @@ -0,0 +1,50 @@ +getPdo(); + return true; + } catch(\Exception $e){ + return false; + } + }); + return $db_connection; + } + + public function up() + { + Schema::connection('mysql7')->table('customer', function (Blueprint $table) { + $table->string('nota_pekerjaan')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('customer', function (Blueprint $table) { + $table->dropColumn('nota_pekerjaan'); + }); + } +}