app/Http/Controllers/TestProjectController.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)
	{
		$validator = \Validator::make($request->all(), array(
			'release' => 'required',
			'name' => 'required'         
			));
		if ($validator->fails())
		{
			foreach ($validator->errors()->toArray() as $key => $value) {
				$error[]=$value[0];
			} 
		}
		else{
			if( session()->has('email')){
				$id = $content['tp_id']            	= $this->genrateRandomInt();
				$content['tp_name']                 = $request->name;
				$content['release']                 = $request->release;	
				$content['package_name']            = $request->package_name;
				$content['activity_name']           = $request->activity_name;							
		        $content['created_by'] 				= session()->get('email');
		        $content['description']             = $request->description;
		        $create 							= \App\TestProject::create($content);
		        $user = \App\User::where('email',session()->get('email'))->update(['open_project' => $id]);
				session(['open_project' => $id]);
		        return redirect()->route('profile');
		 	}else
		 	{
		 		$error[] = "Session expired. Please login to continue";
		 	}
	 	}
	 	return redirect()->route('project.create', ['message' => $error])->withInput();
	}
public function store ( Request $ request ) { $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'release' => 'required' , 'name' => 'required' ) ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ error [ ] = $ value [ 0 ] ; } } else { if ( session ( ) -> has ( 'email' ) ) { $ id = $ content [ 'tp_id' ] = $ this -> genrateRandomInt ( ) ; $ content [ 'tp_name' ] = $ request -> name ; $ content [ 'release' ] = $ request -> release ; $ content [ 'package_name' ] = $ request -> package_name ; $ content [ 'activity_name' ] = $ request -> activity_name ; $ content [ 'created_by' ] = session ( ) -> get ( 'email' ) ; $ content [ 'description' ] = $ request -> description ; $ create = \ App \ TestProject :: create ( $ content ) ; $ user = \ App \ User :: where ( 'email' , session ( ) -> get ( 'email' ) ) -> update ( [ 'open_project' => $ id ] ) ; session ( [ 'open_project' => $ id ] ) ; return redirect ( ) -> route ( 'profile' ) ; } else { $ error [ ] = " Session expired. Please login to continue " ; } } return redirect ( ) -> route ( 'project.create' , [ 'message' => $ error ] ) -> withInput ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
//Validations //Process when validations pass