app/Http/Controllers/TestLabController.php
/**
 * Store a newly created resource in storage.
 *
 * @return Response
 */
Store a newly created resource in storage.
@return Response
Store a newly created resource in storage . @return Response
public function store(Request $request)
{
	$tsc_id 		= $request->tsc_id;
	$id 			= $request->tc_ids;
	$ids 			= explode($this->getDelimiterChar(),$id,-1);
	$scl_id 		= 0;
	$validator = \Validator::make($request->all(), array(
			'release' => 'required',
			'cycle' => 'required'
			));	
	if ($validator->fails())
	{
		foreach ($validator->errors()->toArray() as $key => $value) {
			$error[]=$value[0];
		} 
	}	
	$scenarios 							= \App\TestScenario::where('tsc_id', $tsc_id)->get();	
	$cases 								= \App\TestCase::find($ids); 
	$excel_data['release_version'] 		= $request->release."/".$request->cycle;
	$excel_data['os_version']			= $request->os_version;
	$excel_data['network_type']			= $request->network_type;
	$excel_data['device_name']			= $request->device_name;
	$lab_obj = new LabHandler();
	foreach ($scenarios as $sc) {
		$scl_id = $lab_obj->createScLabByScenarioDetails($sc);
		foreach ($cases as $c_value) {
			$tc_id = $c_value['tc_id'];
		   	$excel_data = $lab_obj->createLabByCase($c_value, $sc->tf_id, $scl_id, $excel_data);
		   	$tl_id = $excel_data['Test Case ID'];
		   	$steps 						= \App\TestStep::where(['tc_id'=> $tc_id, 'soft_delete' => false])->orderBy('seq_no', 'asc')->get();
			$step_count = 0;
			foreach ($steps as $ts_value) {
	    		   	$excel_data = $lab_obj->createExecutionByStep($ts_value, $tl_id, $excel_data);
	    		    $final_data[] = $excel_data; 
	    		   	$step_count++;
	        }
		}
	}
	$message = $this->getMessage('messages.success');
	Toast::message($message, 'success');	
	return redirect()->route('tsc_lab', ['scl_id' => $scl_id]);	
}
public function store ( Request $ request ) { $ tsc_id = $ request -> tsc_id ; $ id = $ request -> tc_ids ; $ ids = explode ( $ this -> getDelimiterChar ( ) , $ id , - 1 ) ; $ scl_id = 0 ; $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'release' => 'required' , 'cycle' => 'required' ) ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ error [ ] = $ value [ 0 ] ; } } $ scenarios = \ App \ TestScenario :: where ( 'tsc_id' , $ tsc_id ) -> get ( ) ; $ cases = \ App \ TestCase :: find ( $ ids ) ; $ excel_data [ 'release_version' ] = $ request -> release . " / " . $ request -> cycle ; $ excel_data [ 'os_version' ] = $ request -> os_version ; $ excel_data [ 'network_type' ] = $ request -> network_type ; $ excel_data [ 'device_name' ] = $ request -> device_name ; $ lab_obj = new LabHandler ( ) ; foreach ( $ scenarios as $ sc ) { $ scl_id = $ lab_obj -> createScLabByScenarioDetails ( $ sc ) ; foreach ( $ cases as $ c_value ) { $ tc_id = $ c_value [ 'tc_id' ] ; $ excel_data = $ lab_obj -> createLabByCase ( $ c_value , $ sc -> tf_id , $ scl_id , $ excel_data ) ; $ tl_id = $ excel_data [ 'Test Case ID' ] ; $ steps = \ App \ TestStep :: where ( [ 'tc_id' => $ tc_id , 'soft_delete' => false ] ) -> orderBy ( 'seq_no' , 'asc' ) -> get ( ) ; $ step_count = 0 ; foreach ( $ steps as $ ts_value ) { $ excel_data = $ lab_obj -> createExecutionByStep ( $ ts_value , $ tl_id , $ excel_data ) ; $ final_data [ ] = $ excel_data ; $ step_count ++ ; } } } $ message = $ this -> getMessage ( 'messages.success' ) ; Toast :: message ( $ message , 'success' ) ; return redirect ( ) -> route ( 'tsc_lab' , [ 'scl_id' => $ scl_id ] ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//foreach ($ids as $id) { /*	$cases = \App\TestCase::where('tsc_id' , $id )->orderBy('seq_no', 'asc')->get()->toArray();
		*/ //echo $c_value['tc_name']; //}