From 233a7720adc2e1e24a061232405c9d7fdf704198 Mon Sep 17 00:00:00 2001 From: wahyuun Date: Fri, 23 Feb 2024 13:32:09 +0700 Subject: [PATCH] update HRController --- app/Http/Controllers/HumanResourceController.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/HumanResourceController.php b/app/Http/Controllers/HumanResourceController.php index acffb77..27fa833 100644 --- a/app/Http/Controllers/HumanResourceController.php +++ b/app/Http/Controllers/HumanResourceController.php @@ -119,11 +119,11 @@ class HumanResourceController extends Controller if(empty($humanresource)) { return response()->json(['status' => 'failed', 'message' => 'Data Human Resource not found!', 'code' => 400], 400); } - $transaction = ProductTransaction::query() - ->where('company_id', $request->company_id); - $cloneQueryTransaction = clone $transaction; - if($request->company_id && isset($request->password) && isset($request->username)) : + if($request->company_id && isset($request->password) && isset($request->username)) { + $transaction = ProductTransaction::query() + ->where('company_id', $request->company_id); + $cloneQueryTransaction = clone $transaction; $countCreate = false; $projectResult = HumanResource::query() ->selectRaw('count(*) as total_hr') @@ -144,7 +144,9 @@ class HumanResourceController extends Controller } else { $countCreate = true; } - endif; + } else { + $countCreate = true; + } $request->ktp_number !== $humanresource['ktp_number'] ? $this->validate($request,['ktp_number'=>'unique:m_users,ktp_number|string']) : ''; $request->email !== $humanresource['email'] ? $this->validate($request,['email'=>'unique:m_users,email|email']) : ''; $request->password ? $this->validate($request,['password'=>'required|min:8']) : '';