app/Http/Controllers/TestLabController.php
/**
 * Show the form for creating a new resource.
 *
 * @return Response
 */
Show the form for creating a new resource.
@return Response
Show the form for creating a new resource . @return Response
public function create(Request $request)
{
	$lab_cases = [];
	$tc_ids = '';
	$tsc_id = $request->tsc_id;
	$scenario = \App\TestScenario::find($tsc_id);
	if($scenario == null)
	{
		$message = $this->getMessage('messages.something_went_wrong');
		Toast::message($message, 'danger');	
		return redirect()->back();	
	}
	else{
		foreach ($request->except('tsc_id', 'select_all', 'type') as $check_key => $check_value) {
			$id 		= $check_key ; 
			$tc_ids		= $tc_ids.$id.$this->getDelimiterChar();
			$case = \App\TestCase::find($id);		
			$steps_counts =  \App\TestStep::groupBy('status')->select('status', DB::raw('count(*) as count'))->where("tc_id" , $id)->get();
			$case->steps = $this->getCountFormat($steps_counts);
			$lab_cases [] = $case;
		}		
		return view('testlab.create_sc_lab', ['cases' => $lab_cases, 'scenario' => $scenario , 'tc_ids' => $tc_ids]);
	}
}
public function create ( Request $ request ) { $ lab_cases = [ ] ; $ tc_ids = '' ; $ tsc_id = $ request -> tsc_id ; $ scenario = \ App \ TestScenario :: find ( $ tsc_id ) ; if ( $ scenario == null ) { $ message = $ this -> getMessage ( 'messages.something_went_wrong' ) ; Toast :: message ( $ message , 'danger' ) ; return redirect ( ) -> back ( ) ; } else { foreach ( $ request -> except ( 'tsc_id' , 'select_all' , 'type' ) as $ check_key => $ check_value ) { $ id = $ check_key ; $ tc_ids = $ tc_ids . $ id . $ this -> getDelimiterChar ( ) ; $ case = \ App \ TestCase :: find ( $ id ) ; $ steps_counts = \ App \ TestStep :: groupBy ( 'status' ) -> select ( 'status' , DB :: raw ( 'count(*) as count' ) ) -> where ( " tc_id " , $ id ) -> get ( ) ; $ case -> steps = $ this -> getCountFormat ( $ steps_counts ) ; $ lab_cases [ ] = $ case ; } return view ( 'testlab.create_sc_lab' , [ 'cases' => $ lab_cases , 'scenario' => $ scenario , 'tc_ids' => $ tc_ids ] ) ; } }
Show the form for creating a new resource.
Show the form for creating a new resource .
//print_r($request->all()); exit; //echo $check_key; exit; //$testcase 	= explode('.', $check_key); //$testcase[1];