app/Http/Controllers/Handlers/CloneHandler.php
/*
		Clone all test cases for given FROM from_tsc_id to TO to_tsc_id
	*/
Clone all test cases for given FROM from_tsc_id to TO to_tsc_id
Clone all test cases for given FROM from_tsc_id to TO to_tsc_id
public function cloneAllCases($from_tsc_id, $to_tsc_id, $allSteps)
	{
		$collection = \App\TestCase::where('tsc_id' , $from_tsc_id)->get()->toArray();
		foreach ($collection as $value) {
	        $old_tc_id 		= $value['tc_id'] ;
			$value['tc_id'] = $to_tsc_id."_".$this->genrateRandomInt();
			$value['tsc_id']= $to_tsc_id;
			$value['tp_id'] = session()->get('open_project');
			$value['status']= 'not_executed';
			\App\TestCase::create($value);
			if($allSteps == true)
				$this->cloneAllSteps($old_tc_id, $value['tc_id']);
		}
		return;
	}
public function cloneAllCases ( $ from_tsc_id , $ to_tsc_id , $ allSteps ) { $ collection = \ App \ TestCase :: where ( 'tsc_id' , $ from_tsc_id ) -> get ( ) -> toArray ( ) ; foreach ( $ collection as $ value ) { $ old_tc_id = $ value [ 'tc_id' ] ; $ value [ 'tc_id' ] = $ to_tsc_id . " _ " . $ this -> genrateRandomInt ( ) ; $ value [ 'tsc_id' ] = $ to_tsc_id ; $ value [ 'tp_id' ] = session ( ) -> get ( 'open_project' ) ; $ value [ 'status' ] = 'not_executed' ; \ App \ TestCase :: create ( $ value ) ; if ( $ allSteps == true ) $ this -> cloneAllSteps ( $ old_tc_id , $ value [ 'tc_id' ] ) ; } return ; }
Clone all test cases for given FROM from_tsc_id to TO to_tsc_id
Clone all test cases for given FROM from_tsc_id to TO to_tsc_id
//clone all steps for this testcase //echo "Cloning case -  ".$value['tc_name']."<br/>";