update model test
This commit is contained in:
parent
fc990ffa81
commit
cc0c47510d
@ -34,7 +34,7 @@ class TestDef extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class TestDef extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class TestDefCal extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class TestDefCal extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data' => $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,7 +39,7 @@ class TestDefSite extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ class TestDefSite extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class TestDefTech extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class TestDefTech extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class TestGrp extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class TestGrp extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data'=> $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class TestMap extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors($this->validator->getErrors()); }
|
||||||
try {
|
try {
|
||||||
$id = $this->model->insert($input);
|
$id = $this->model->insert($input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id created successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data created successfully", 'data' => $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ class TestMap extends BaseController {
|
|||||||
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
if (!$this->validateData($input, $this->rules)) { return $this->failValidationErrors( $this->validator->getErrors() ); }
|
||||||
try {
|
try {
|
||||||
$this->model->update($id,$input);
|
$this->model->update($id,$input);
|
||||||
return $this->respondCreated([ 'status' => 'success', 'message' => "data $id updated successfully" ]);
|
return $this->respondCreated([ 'status' => 'success', 'message' => "data updated successfully", 'data' => $id ]);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
return $this->failServerError('Something went wrong: ' . $e->getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ class CreateTestsTable extends Migration {
|
|||||||
'DisciplineID' => ['type' => 'INT', 'null' => false],
|
'DisciplineID' => ['type' => 'INT', 'null' => false],
|
||||||
'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true],
|
'Method' => ['type' => 'varchar', 'constraint'=>50, 'null' => true],
|
||||||
'Seq' => ['type' => 'int', 'constraint'=> 15, 'null' => true],
|
'Seq' => ['type' => 'int', 'constraint'=> 15, 'null' => true],
|
||||||
'CountStat' => ['type' => 'int' ],
|
'CountStat' => ['type' => 'int', 'null' => true ],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
]);
|
]);
|
||||||
@ -29,12 +29,12 @@ class CreateTestsTable extends Migration {
|
|||||||
'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false],
|
'TestSiteName' => ['type' => 'varchar', 'constraint'=> 50, 'null' => false],
|
||||||
'Type' => ['type' => 'int', 'null' => false],
|
'Type' => ['type' => 'int', 'null' => false],
|
||||||
'Description' => ['type' => 'varchar', 'constraint'=> 150, 'null' => true],
|
'Description' => ['type' => 'varchar', 'constraint'=> 150, 'null' => true],
|
||||||
'SeqScr' => ['type' => 'int', 'null' => false],
|
'SeqScr' => ['type' => 'int', 'null' => true],
|
||||||
'SeqRpt' => ['type' => 'int', 'null' => false],
|
'SeqRpt' => ['type' => 'int', 'null' => true],
|
||||||
'IndentLeft' => ['type' => 'int', 'null' => false],
|
'IndentLeft' => ['type' => 'int', 'null' => true],
|
||||||
'VisibleScr' => ['type' => 'int', 'null' => false],
|
'VisibleScr' => ['type' => 'int', 'null' => true],
|
||||||
'VisibleRpt' => ['type' => 'int', 'null' => false],
|
'VisibleRpt' => ['type' => 'int', 'null' => true],
|
||||||
'CountStat' => ['type' => 'int', 'null' => false],
|
'CountStat' => ['type' => 'int', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
'EndDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
]);
|
]);
|
||||||
@ -44,7 +44,7 @@ class CreateTestsTable extends Migration {
|
|||||||
$this->forge->addField([
|
$this->forge->addField([
|
||||||
'TestTechID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'TestTechID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'SiteID' => ['type' => 'INT', 'null' => true],
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
||||||
'TestSiteID' => ['type' => 'INT', 'null' => true],
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
||||||
'DisciplineID' => ['type' => 'int', 'null' => true],
|
'DisciplineID' => ['type' => 'int', 'null' => true],
|
||||||
'DepartmentID' => ['type' => 'int', 'null' => true],
|
'DepartmentID' => ['type' => 'int', 'null' => true],
|
||||||
'WorkstationID' => ['type' => 'int', 'null' => true],
|
'WorkstationID' => ['type' => 'int', 'null' => true],
|
||||||
@ -69,7 +69,7 @@ class CreateTestsTable extends Migration {
|
|||||||
$this->forge->addField([
|
$this->forge->addField([
|
||||||
'TestCalID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'TestCalID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'SiteID' => ['type' => 'INT', 'null' => true],
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
||||||
'TestSiteID' => ['type' => 'INT', 'null' => true],
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
||||||
'DisciplineID' => ['type' => 'INT', 'null' => true],
|
'DisciplineID' => ['type' => 'INT', 'null' => true],
|
||||||
'DepartmentID' => ['type' => 'INT', 'null' => true],
|
'DepartmentID' => ['type' => 'INT', 'null' => true],
|
||||||
'FormulaCode' => ['type' => 'varchar', 'constraint'=>150, 'null' => true],
|
'FormulaCode' => ['type' => 'varchar', 'constraint'=>150, 'null' => true],
|
||||||
@ -87,7 +87,7 @@ class CreateTestsTable extends Migration {
|
|||||||
$this->forge->addField([
|
$this->forge->addField([
|
||||||
'TestGrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
'TestGrpID' => ['type' => 'INT', 'auto_increment' => true, 'unsigned' => true],
|
||||||
'SiteID' => ['type' => 'INT', 'null' => true],
|
'SiteID' => ['type' => 'INT', 'null' => true],
|
||||||
'TestSiteID' => ['type' => 'INT', 'null' => true],
|
'TestSiteID' => ['type' => 'INT', 'null' => false],
|
||||||
'Member' => ['type' => 'INT', 'null' => true],
|
'Member' => ['type' => 'INT', 'null' => true],
|
||||||
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
'CreateDate' => ['type' => 'Datetime', 'null' => true],
|
||||||
'EndDate' => ['type' => 'Datetime', 'null' => true]
|
'EndDate' => ['type' => 'Datetime', 'null' => true]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user