|
|
|
@ -10,7 +10,8 @@ use Illuminate\Support\Facades\Artisan;
|
|
|
|
|
|
|
|
|
|
class HumanResourceController extends Controller |
|
|
|
|
{ |
|
|
|
|
public function add(Request $request){ |
|
|
|
|
public function add(Request $request) |
|
|
|
|
{ |
|
|
|
|
$this->validate($request, [ |
|
|
|
|
'role_id' => 'required', |
|
|
|
|
'name' => 'required', |
|
|
|
@ -33,7 +34,8 @@ class HumanResourceController extends Controller
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function edit($id){ |
|
|
|
|
public function edit($id) |
|
|
|
|
{ |
|
|
|
|
if (!$id || (int) $id < 0 || $id == "") { |
|
|
|
|
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); |
|
|
|
|
die(); |
|
|
|
@ -48,7 +50,8 @@ class HumanResourceController extends Controller
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function update(Request $request, $id){ |
|
|
|
|
public function update(Request $request, $id) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
if (!$id || (int) $id < 0 || $id == "") { |
|
|
|
|
return response()->json(['status' => 'failed', 'message' => 'id is required!', 'code' => 400], 400); |
|
|
|
@ -112,7 +115,7 @@ class HumanResourceController extends Controller
|
|
|
|
|
|
|
|
|
|
public function list() |
|
|
|
|
{ |
|
|
|
|
$data = HumanResource::select('id', 'name')->get(); |
|
|
|
|
$data = HumanResource::select('id', 'name', 'role_id')->get(); |
|
|
|
|
$countData = $data->count(); |
|
|
|
|
|
|
|
|
|
if ($data) { |
|
|
|
@ -122,7 +125,8 @@ class HumanResourceController extends Controller
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function select(Request $request){ |
|
|
|
|
public function select(Request $request) |
|
|
|
|
{ |
|
|
|
|
|
|
|
|
|
$search = $request->query('search'); |
|
|
|
|
|
|
|
|
@ -177,17 +181,16 @@ class HumanResourceController extends Controller
|
|
|
|
|
$data['old_password'] = md5($request->old_password); |
|
|
|
|
if ($data['old_password'] !== $result->password) { |
|
|
|
|
return response()->json(['status' => 'failed', 'message' => "old password seems doesn't match in records. please try again.", 'code' => 400], 400); |
|
|
|
|
} |
|
|
|
|
elseif($data['old_password'] === $result->password) { |
|
|
|
|
} elseif ($data['old_password'] === $result->password) { |
|
|
|
|
return response()->json(['status' => 'success', 'message' => "old password match", 'data' => $result, 'code' => 200], 200); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
} else { |
|
|
|
|
return response()->json(['status' => 'failed', 'message' => 'old_password is required!', 'code' => 400], 400); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function sync(){ |
|
|
|
|
public function sync() |
|
|
|
|
{ |
|
|
|
|
Artisan::call('sync:integration-human-resources'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|