app/Http/Controllers/TestStepController.php
/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
Update the specified resource in storage.
@param  int  $id
@return Response
Update the specified resource in storage . @param int $id @return Response
public function update($id, Request $request)
	{
		$validator = \Validator::make($request->all(), array(
			'description' => 'required',
			'expected_result' => 'required'
			));
		if ($validator->fails())
		{
			foreach ($validator->errors()->toArray() as $key => $value) {
				$error[]=$value[0];
			} 
		}
		else{
			if( session()->has('email')){
				$level = $request->update_level; 	
				$content['description']             = $request->description;
		        $content['expected_result']         = $request->expected_result;
		        $item = \App\TestStep::find($id);
		        $item->update($content);
		        $execution_content['scroll']		= $request->scroll;
		        $execution_content['resource_id']	= $request->resource_id;
		        $execution_content['text']			= $request->text;
		        $execution_content['content_desc']	= $request->content_desc;
		        $execution_content['class']			= $request->class;
		        $execution_content['index']			= $request->index;
		        $execution_content['sendkey']		= $request->sendkey;
		        $execution_content['screenshot']	= $request->screenshot;
		        $execution_content['checkpoint']	= $request->checkpoint;
		        $execution_content['wait']			= $request->wait;		        
				$tc_id								= $request->tc_id;
		        $result = \App\Execution::where(['ts_id' => $id, 'tl_id' => 0])->update($execution_content);
				$del_obj = new DeleteQueryHandler();				
	        	$condition = $del_obj->getCondition($item, $level);
	        	$condition['soft_delete'] = false;
	        	$all_steps = \App\TestStep::where($condition)->get();
	        	foreach ($all_steps as $step_value) {
	        		if($step_value->ts_id != $id)
	        		{
	        			$step_value->update($content);
	        			\App\Execution::where(['ts_id' => $step_value->ts_id, 'tl_id' => 0])->update($execution_content);
	        		}
	        	}
	        	$message = $this->getMessage('messages.success');
	        	$message.= " Total Steps updated = ".count($all_steps);
				Toast::success($message);
				return redirect()->route('testcase.show', ['id' => $tc_id]);
		 	}else
		 	{
		 		$error[] = "Session expired. Please login to continue";
		 	}
	 	}
	 	return redirect()->route('teststep.edit', ['id' => $id, 'message' => $error])->withInput();
	}
public function update ( $ id , Request $ request ) { $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'description' => 'required' , 'expected_result' => 'required' ) ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ error [ ] = $ value [ 0 ] ; } } else { if ( session ( ) -> has ( 'email' ) ) { $ level = $ request -> update_level ; $ content [ 'description' ] = $ request -> description ; $ content [ 'expected_result' ] = $ request -> expected_result ; $ item = \ App \ TestStep :: find ( $ id ) ; $ item -> update ( $ content ) ; $ execution_content [ 'scroll' ] = $ request -> scroll ; $ execution_content [ 'resource_id' ] = $ request -> resource_id ; $ execution_content [ 'text' ] = $ request -> text ; $ execution_content [ 'content_desc' ] = $ request -> content_desc ; $ execution_content [ 'class' ] = $ request -> class ; $ execution_content [ 'index' ] = $ request -> index ; $ execution_content [ 'sendkey' ] = $ request -> sendkey ; $ execution_content [ 'screenshot' ] = $ request -> screenshot ; $ execution_content [ 'checkpoint' ] = $ request -> checkpoint ; $ execution_content [ 'wait' ] = $ request -> wait ; $ tc_id = $ request -> tc_id ; $ result = \ App \ Execution :: where ( [ 'ts_id' => $ id , 'tl_id' => 0 ] ) -> update ( $ execution_content ) ; $ del_obj = new DeleteQueryHandler ( ) ; $ condition = $ del_obj -> getCondition ( $ item , $ level ) ; $ condition [ 'soft_delete' ] = false ; $ all_steps = \ App \ TestStep :: where ( $ condition ) -> get ( ) ; foreach ( $ all_steps as $ step_value ) { if ( $ step_value -> ts_id != $ id ) { $ step_value -> update ( $ content ) ; \ App \ Execution :: where ( [ 'ts_id' => $ step_value -> ts_id , 'tl_id' => 0 ] ) -> update ( $ execution_content ) ; } } $ message = $ this -> getMessage ( 'messages.success' ) ; $ message .= "  Total Steps updated =  " . count ( $ all_steps ) ; Toast :: success ( $ message ) ; return redirect ( ) -> route ( 'testcase.show' , [ 'id' => $ tc_id ] ) ; } else { $ error [ ] = " Session expired. Please login to continue " ; } } return redirect ( ) -> route ( 'teststep.edit' , [ 'id' => $ id , 'message' => $ error ] ) -> withInput ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//Process when validations pass //exit; //return redirect()->route('teststep.show', ['id' => $id]); /*
	 	$message = $this->getMessage('messages.update_failed');
    	Toast::message($message, 'danger');*/