app/Http/Controllers/TestcaseController.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)
	{
		$message = "";
		$messages = [
		    'tsc_id.not_in' => 'The test scenario selection is required.'
		];
		$validator = \Validator::make($request->all(), array(
			'name' => 'required',
			'tsc_id' => 'not_in:none'        
			), $messages);
		if ($validator->fails())
		{
			foreach ($validator->errors()->toArray() as $key => $value) {
				$message .= $value[0]."\n"; 
			} 
			Toast::message($message, 'danger'); 
		}
		else{
			if( session()->has('email')){
				$content['tc_id']                 	= $request->tsc_id."_".$this->genrateRandomInt();				
				$content['tc_name']                 = $request->name;
				$content['created_by'] 				= session()->get('email');
		        $content['description']             = $request->description;
		        $content['expected_result']         = $request->expected_result;
				$content['status']             		= "not_executed";
		        $content['tp_id']                 	= session()->get('open_project');
		        $content['tsc_id']                 	= $request->tsc_id;	
		        $content['bug_id']					= "";
		       	$content['execution_type']			= "NA" ;
		       	$content['execution_by']			= "" ;
		       	$content_lab['execution_by_name']	= "" ;
		       	$content['tc_priority']				= "" ;
		       	$count 								= \App\TestCase::where('tsc_id',  $content['tsc_id'])->count();
		       	$content['seq_no'] 	        		= $count+1;	
		        $create 							= \App\TestCase::create($content);
			 	return redirect()->route('testcase.show', ['id' => $content['tc_id']]);
		 	}else
		 	{
		 		$error[] = "Session expired. Please login to continue";
		 	}
	 	}
		return redirect()->route('testcase.create')->withInput();
	}
public function store ( Request $ request ) { $ message = " " ; $ messages = [ 'tsc_id.not_in' => 'The test scenario selection is required.' ] ; $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'name' => 'required' , 'tsc_id' => 'not_in:none' ) , $ messages ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ message .= $ value [ 0 ] . " \n " ; } Toast :: message ( $ message , 'danger' ) ; } else { if ( session ( ) -> has ( 'email' ) ) { $ content [ 'tc_id' ] = $ request -> tsc_id . " _ " . $ this -> genrateRandomInt ( ) ; $ content [ 'tc_name' ] = $ request -> name ; $ content [ 'created_by' ] = session ( ) -> get ( 'email' ) ; $ content [ 'description' ] = $ request -> description ; $ content [ 'expected_result' ] = $ request -> expected_result ; $ content [ 'status' ] = " not_executed " ; $ content [ 'tp_id' ] = session ( ) -> get ( 'open_project' ) ; $ content [ 'tsc_id' ] = $ request -> tsc_id ; $ content [ 'bug_id' ] = " " ; $ content [ 'execution_type' ] = " NA " ; $ content [ 'execution_by' ] = " " ; $ content_lab [ 'execution_by_name' ] = " " ; $ content [ 'tc_priority' ] = " " ; $ count = \ App \ TestCase :: where ( 'tsc_id' , $ content [ 'tsc_id' ] ) -> count ( ) ; $ content [ 'seq_no' ] = $ count + 1 ; $ create = \ App \ TestCase :: create ( $ content ) ; return redirect ( ) -> route ( 'testcase.show' , [ 'id' => $ content [ 'tc_id' ] ] ) ; } else { $ error [ ] = " Session expired. Please login to continue " ; } } return redirect ( ) -> route ( 'testcase.create' ) -> withInput ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//Process when validations pass then create test case //$create_lab 						= \App\Lab::create($content_lab); //print_r($create); exit;