Browse Source

Task #860q7btm6 cek username

pull/3/head
Wahyu Ramadhan 2 years ago
parent
commit
b284e235d4
  1. 4
      app/Http/Controllers/HumanResourceController.php

4
app/Http/Controllers/HumanResourceController.php

@ -60,6 +60,10 @@ class HumanResourceController extends Controller
if(isset($request->password) && $request->password!="" ){
$data['password'] = md5($request->password);
}
if(isset($data['username']) && HumanResource::where('username', $data['username'])->where('id', '<>', $id)->exists()){
return response()->json(['status'=>'failed','message'=>'Username already exists!','code'=>400], 400);
}
if($humanresource){
$result = $humanresource->update($data);

Loading…
Cancel
Save