Browse Source

assign customer

pull/3/head
wahyuun 1 year ago
parent
commit
abc80b7807
  1. 7
      app/Http/Controllers/HumanResourceController.php

7
app/Http/Controllers/HumanResourceController.php

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

Loading…
Cancel
Save