fix update organization controller

This commit is contained in:
mahdahar 2025-10-31 11:11:45 +07:00
parent 112e6ec311
commit 6b9261f853
4 changed files with 10 additions and 4 deletions

View File

@ -63,7 +63,7 @@ class Department extends BaseController {
$input = $this->request->getJSON(true);
try {
$id = $input['DepartmentID'];
$this->model->where('DepartmentID', $id)->update();
$this->model->update($id, $input);
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
} catch (\Throwable $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());

View File

@ -61,12 +61,18 @@ class Discipline extends BaseController {
public function update() {
$input = $this->request->getJSON(true);
$id = $input['DisciplineID'];
$this->model->update($id, $input);
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
/*
try {
$id = $input['DisciplineID'];
$this->model->where('DisciplineID', $id)->update();
echo $this->model->getLastQuery();
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
} catch (\Throwable $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());
return $this->failServerError('Something went wrong: ' . $e->getMessage() );
}
*/
}
}

View File

@ -63,7 +63,7 @@ class Workbench extends BaseController {
$input = $this->request->getJSON(true);
try {
$id = $input['WorkbenchID'];
$this->model->where('WorkbenchID', $id)->update();
$this->model->update($id, $input);
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
} catch (\Throwable $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());

View File

@ -63,7 +63,7 @@ class Workstation extends BaseController {
$input = $this->request->getJSON(true);
try {
$id = $input['WorkstationID'];
$this->model->where('WorkstationID', $id)->update();
$this->model->update($id, $input);
return $this->respondCreated([ 'status' => 'success', 'message' => 'data updated successfully', 'data' => $id ], 201);
} catch (\Throwable $e) {
return $this->failServerError('Something went wrong: ' . $e->getMessage());