mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 07:51:05 +03:30
Structor CSSD
This commit is contained in:
@@ -22,7 +22,7 @@ class TestResultController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
public function CreateChildFormValue($InputChild,$TestResultObj,$TestResultInfo)
|
||||
public function CreateChildFormValue2($InputChild,$TestResultObj,$TestResultInfo)
|
||||
{
|
||||
// dd($TestResultInfo[$InputChild->name]);
|
||||
// foreach ($Input->children as $InputChild) {
|
||||
@@ -40,6 +40,34 @@ class TestResultController extends Controller
|
||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value]);
|
||||
// dd(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value]);
|
||||
// }
|
||||
}
|
||||
public function CreateChildFormValue($Input,$TestResultObj,$TestResultInfo)
|
||||
{
|
||||
// dd($Input->children[0]->children);
|
||||
// if ($Input->type == 'Form') {
|
||||
// code...
|
||||
|
||||
// $TestResultInfo = $TestResultInfo[$Input->name];
|
||||
foreach ($Input->children as $InputChild) {
|
||||
|
||||
// $TestResultInfo = $TestResultInfo[$InputChild->name];
|
||||
|
||||
if ($InputChild->type == 'Form') {
|
||||
|
||||
// dd($TestResultInfo[$InputChild->name]);
|
||||
$this->CreateChildFormValue($InputChild,$TestResultObj,$TestResultInfo[$InputChild->name]);
|
||||
// dd($InputChild);
|
||||
}
|
||||
else {
|
||||
$Value = $TestResultInfo[$InputChild->name];
|
||||
// dd($Value);
|
||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value ]);
|
||||
}
|
||||
|
||||
}
|
||||
return 'success';
|
||||
|
||||
|
||||
}
|
||||
public function store(StoreTestResultRequest $request)
|
||||
{
|
||||
@@ -57,39 +85,77 @@ class TestResultController extends Controller
|
||||
// $TestResultInfo = $request['info'];
|
||||
$TestResultInfo = [];
|
||||
|
||||
$Inputs = Input::with('options','children')->where('test_type_id',$request->test_type_id)->get();
|
||||
$Inputs = Input::with('options','children','children.children')->where('test_type_id',$request->test_type_id)->get();
|
||||
// dd($Inputs->toArray()[2]);
|
||||
// foreach ($Inputs as $Input) {
|
||||
// if ($Input['type'] == 'Form') {
|
||||
// $TestResultInfo = $request[$Input->name];
|
||||
//
|
||||
// // $this->CreateChildFormValue($Input,$TestResultObj,$TestResultInfo);
|
||||
//
|
||||
// ///--------------------------------------------------
|
||||
// foreach ($Input->children as $InputChild) {
|
||||
//
|
||||
// $this->CreateChildFormValue($InputChild,$TestResultObj,$TestResultInfo);
|
||||
// ///--------------------------------------------------
|
||||
// // $Value = $TestResultInfo[$InputChild->name];
|
||||
// //
|
||||
// // if ($InputChild->type == 'Form') {
|
||||
// // foreach ($InputChild->children as $InputChild2) {
|
||||
// // $Value = $TestResultInfo[$InputChild->name][$InputChild2->name];
|
||||
// // $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild2['id'] , 'value' => $Value]);
|
||||
// // return 'success';
|
||||
// // }
|
||||
// //
|
||||
// // }
|
||||
// // $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value]);
|
||||
// }
|
||||
// ///--------------------------------------------------
|
||||
// }
|
||||
// else {
|
||||
// $TestResultInfo = $request->all();
|
||||
// }
|
||||
// $Value = $TestResultInfo[$Input->name];
|
||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $Input->id , 'value' => $Value]);
|
||||
// }
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
foreach ($Inputs as $Input) {
|
||||
if ($Input['type'] == 'Form') {
|
||||
$TestResultInfo = $request[$Input->name];
|
||||
$TestResultInfo = $request[$Input->name];//-----estesna
|
||||
|
||||
// $this->CreateChildFormValue($Input,$TestResultObj,$TestResultInfo);
|
||||
|
||||
$this->CreateChildFormValue($Input,$TestResultObj,$TestResultInfo);
|
||||
|
||||
//******
|
||||
///--------------------------------------------------
|
||||
foreach ($Input->children as $InputChild) {
|
||||
|
||||
$this->CreateChildFormValue($InputChild,$TestResultObj,$TestResultInfo);
|
||||
///--------------------------------------------------
|
||||
// $Value = $TestResultInfo[$InputChild->name];
|
||||
//
|
||||
// if ($InputChild->type == 'Form') {
|
||||
// foreach ($InputChild->children as $InputChild2) {
|
||||
// $Value = $TestResultInfo[$InputChild->name][$InputChild2->name];
|
||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild2['id'] , 'value' => $Value]);
|
||||
// return 'success';
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value]);
|
||||
}
|
||||
// foreach ($Input->children as $InputChild) {
|
||||
//
|
||||
// $TestResultInfo = $TestResultInfo[$InputChild->name];
|
||||
// // dd($TestResultInfo);
|
||||
// if ($InputChild->type == 'Form') {
|
||||
// foreach ($InputChild->children as $InputChild2) {
|
||||
//
|
||||
// $Value = $TestResultInfo[$InputChild->name][$InputChild2->name];
|
||||
//
|
||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild2['id'] , 'value' => $Value]);
|
||||
// return 'success';
|
||||
// }
|
||||
// }
|
||||
// $InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $InputChild['id'] , 'value' => $Value]);
|
||||
// }
|
||||
///--------------------------------------------------
|
||||
}
|
||||
else {
|
||||
$TestResultInfo = $request->all();
|
||||
// $TestResultInfo = $request->all();
|
||||
$Value = $request[$Input->name];
|
||||
// dd($Value);
|
||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $Input->id , 'value' => $Value]);
|
||||
}
|
||||
$Value = $TestResultInfo[$Input->name];
|
||||
$InputValueObj = InputValue::create(['test_result_id' => $TestResultObj->id , 'input_id' => $Input->id , 'value' => $Value]);
|
||||
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
});
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user