app/Http/Controllers/TestStepController.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)
	{
		$messages = [
		    'tc_id.not_in' => 'The case field is required.'
		];
	 	$tc =  $request->tc_id;
		$validator = \Validator::make($request->all(), array(
			'description' => 'required',
			'tc_id' => 'not_in:none'        
			), $messages);
		if ($validator->fails())
		{
			foreach ($validator->errors()->toArray() as $key => $value) {
				$error[]=$value[0];
			} 
		}
		else{
			if(session()->has('email')){
				$store_obj = new StoreQueryHandler();
				$level =  $request->add_level;
				$condition = $store_obj->getAddCondition($level, $tc);
				$all_cases = \App\TestCase::where($condition)->get();
				foreach ($all_cases as $case_value) {
						$ts_id                	= $case_value->tc_id."_". $this->genrateRandomInt();
						$e_id 					= $ts_id."_".$this->genrateRandomInt();
						$store_obj->addStep($ts_id, $request, $e_id, $case_value->tc_id);
				}
			 	return redirect()->route('testcase.show', ['id' => $tc] );
		 	}else
		 	{
		 		$error[] = "Session expired. Please login to continue";
		 	}
	 	}
	 	return redirect()->route('teststep.create', [ 'tc_id' => $tc, 'message' => $error ])->withInput();
	}
public function store ( Request $ request ) { $ messages = [ 'tc_id.not_in' => 'The case field is required.' ] ; $ tc = $ request -> tc_id ; $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'description' => 'required' , 'tc_id' => 'not_in:none' ) , $ messages ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ error [ ] = $ value [ 0 ] ; } } else { if ( session ( ) -> has ( 'email' ) ) { $ store_obj = new StoreQueryHandler ( ) ; $ level = $ request -> add_level ; $ condition = $ store_obj -> getAddCondition ( $ level , $ tc ) ; $ all_cases = \ App \ TestCase :: where ( $ condition ) -> get ( ) ; foreach ( $ all_cases as $ case_value ) { $ ts_id = $ case_value -> tc_id . " _ " . $ this -> genrateRandomInt ( ) ; $ e_id = $ ts_id . " _ " . $ this -> genrateRandomInt ( ) ; $ store_obj -> addStep ( $ ts_id , $ request , $ e_id , $ case_value -> tc_id ) ; } return redirect ( ) -> route ( 'testcase.show' , [ 'id' => $ tc ] ) ; } else { $ error [ ] = " Session expired. Please login to continue " ; } } return redirect ( ) -> route ( 'teststep.create' , [ 'tc_id' => $ tc , 'message' => $ error ] ) -> withInput ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//Process when validations pass /*$ts_id                	= $tc."_". $this->genrateRandomInt();
				$e_id 					= $ts_id."_".$this->genrateRandomInt();
				$store_obj->addStep($ts_id, $request, $e_id, $tc);
				*/