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