|
|
|
@ -15,7 +15,7 @@ class HumanResourceController extends Controller
|
|
|
|
|
$this->validate($request, [ |
|
|
|
|
'role_id' => 'required', |
|
|
|
|
'name' => 'required', |
|
|
|
|
'ktp_number' => 'required', |
|
|
|
|
'ktp_number' => 'required|numeric|unique:m_users,ktp_number', |
|
|
|
|
'employee_type' => 'required' |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
@ -56,9 +56,12 @@ class HumanResourceController extends Controller
|
|
|
|
|
if (!$id || (int) $id < 0 || $id == "") { |
|
|
|
|
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$humanresource = HumanResource::find($id); |
|
|
|
|
|
|
|
|
|
$request->ktp_number !== $humanresource['ktp_number'] ? $this->validate($request,['ktp_number'=>'unique:m_users,ktp_number|numeric']) : ''; |
|
|
|
|
$request->email !== $humanresource['email'] ? $this->validate($request,['email'=>'unique:m_users,email|email']) : ''; |
|
|
|
|
$request->password ? $this->validate($request,['password'=>'required|min:8']) : ''; |
|
|
|
|
|
|
|
|
|
$data = $request->all(); |
|
|
|
|
|
|
|
|
|
if (isset($request->password) && $request->password != "") { |
|
|
|
|