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

@ -61,6 +61,10 @@ class HumanResourceController extends Controller
$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);
}else{

Loading…
Cancel
Save