app/Http/Controllers/TestStepController.php
/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
Remove the specified resource from storage.
@param  int  $id
@return Response
Remove the specified resource from storage . @param int $id @return Response
public function destroy($id, Request $request)
	{
		$level = ($request->delete_level);
		$tp_id = session()->get('open_project');
		$item = \App\TestStep::find($id);
        if($item){
        	$tc_id = $item->tc_id;
        	$del_obj = new DeleteQueryHandler();
        	$condition = $del_obj->getCondition($item, $level);
        	$all_steps = \App\TestStep::where($condition)->get();
        	foreach ($all_steps as $step_value) {
        		if($step_value->ts_id != $id)
        		{
        			$del_res = $del_obj->deleteExecutionByStepId($step_value->ts_id);
        			$step_value->delete();
        		}
        	}
        	$del_res = $del_obj->deleteExecutionByStepId($id);
			if($del_res == 0)
			{
				$message = $this->getMessage('messages.delete_failed');
				Toast::message($message, 'danger');
			}  else{      	
	        	$item->delete();
				$message = $this->getMessage('messages.delete_success');
				Toast::success($message);
			}
        }
		else{
			$message = $this->getMessage('messages.delete_failed');
			Toast::message($message, 'danger');
			return back();
		}
		return redirect()->route('testcase.show', ['id' => $tc_id ]);
	}
public function destroy ( $ id , Request $ request ) { $ level = ( $ request -> delete_level ) ; $ tp_id = session ( ) -> get ( 'open_project' ) ; $ item = \ App \ TestStep :: find ( $ id ) ; if ( $ item ) { $ tc_id = $ item -> tc_id ; $ del_obj = new DeleteQueryHandler ( ) ; $ condition = $ del_obj -> getCondition ( $ item , $ level ) ; $ all_steps = \ App \ TestStep :: where ( $ condition ) -> get ( ) ; foreach ( $ all_steps as $ step_value ) { if ( $ step_value -> ts_id != $ id ) { $ del_res = $ del_obj -> deleteExecutionByStepId ( $ step_value -> ts_id ) ; $ step_value -> delete ( ) ; } } $ del_res = $ del_obj -> deleteExecutionByStepId ( $ id ) ; if ( $ del_res == 0 ) { $ message = $ this -> getMessage ( 'messages.delete_failed' ) ; Toast :: message ( $ message , 'danger' ) ; } else { $ item -> delete ( ) ; $ message = $ this -> getMessage ( 'messages.delete_success' ) ; Toast :: success ( $ message ) ; } } else { $ message = $ this -> getMessage ( 'messages.delete_failed' ) ; Toast :: message ( $ message , 'danger' ) ; return back ( ) ; } return redirect ( ) -> route ( 'testcase.show' , [ 'id' => $ tc_id ] ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .
//echo "Deleting this Step"; //$expected_result = $item->expected_result; //Delete teststep