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 cloneAllScenarios($from_tf_id, $to_tf_id, $allCases)
	{
		$collection = \App\TestScenario::where('tf_id' , $from_tf_id)->get()->toArray();
		foreach ($collection as $value) {
	        $old_tsc_id 	= $value['tsc_id'] ;
			$value['tsc_id']= $to_tf_id."_".$this->genrateRandomInt();
			$value['tf_id']	= $to_tf_id;
			$value['tp_id'] = session()->get('open_project');
			$value['status']= 'not_executed';
			$value['created_by']= session()->get('email');
			\App\TestScenario::create($value);
			if($allCases == true)
				$this->cloneAllCases($old_tsc_id, $value['tsc_id'], true);
		}
		return;
	}
public function cloneAllScenarios ( $ from_tf_id , $ to_tf_id , $ allCases ) { $ collection = \ App \ TestScenario :: where ( 'tf_id' , $ from_tf_id ) -> get ( ) -> toArray ( ) ; foreach ( $ collection as $ value ) { $ old_tsc_id = $ value [ 'tsc_id' ] ; $ value [ 'tsc_id' ] = $ to_tf_id . " _ " . $ this -> genrateRandomInt ( ) ; $ value [ 'tf_id' ] = $ to_tf_id ; $ value [ 'tp_id' ] = session ( ) -> get ( 'open_project' ) ; $ value [ 'status' ] = 'not_executed' ; $ value [ 'created_by' ] = session ( ) -> get ( 'email' ) ; \ App \ TestScenario :: create ( $ value ) ; if ( $ allCases == true ) $ this -> cloneAllCases ( $ old_tsc_id , $ value [ 'tsc_id' ] , true ) ; } 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 cases for this testcase //echo "Cloning case -  ".$value['tc_name']."<br/>";