app/Http/Controllers/UserController.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',
			'email' => 'required',
			'password' => 'required'
			));
		if ($validator->fails())
		{
			foreach ($validator->errors()->toArray() as $key => $value) {
				$error[]=$value[0];
			} 
		}
		else{
			try{
				$content['email'] 					= $request->email;
				$content['name']                   	= $request->name;
				$content['password']               	= $request->password;
				$content['open_project']            = session()->get('open_project');
				$content['autorun_location']        = session()->get("autorun_location");
				$create_user = \App\User::create($content);
				$message = $this->getMessage('messages.success');
				Toast::message($message, 'success');	
				return redirect()->back();
			}
			catch(Exception $e){
				$message = $this->getMessage('messages.something_went_wrong');
				Toast::message($message, 'danger');	
				return redirect()->back();
			}
		}		 
		return redirect()->route('profile', [ 'message' => $error ])->withInput();
	}
public function store ( Request $ request ) { $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'name' => 'required' , 'email' => 'required' , 'password' => 'required' ) ) ; if ( $ validator -> fails ( ) ) { foreach ( $ validator -> errors ( ) -> toArray ( ) as $ key => $ value ) { $ error [ ] = $ value [ 0 ] ; } } else { try { $ content [ 'email' ] = $ request -> email ; $ content [ 'name' ] = $ request -> name ; $ content [ 'password' ] = $ request -> password ; $ content [ 'open_project' ] = session ( ) -> get ( 'open_project' ) ; $ content [ 'autorun_location' ] = session ( ) -> get ( " autorun_location " ) ; $ create_user = \ App \ User :: create ( $ content ) ; $ message = $ this -> getMessage ( 'messages.success' ) ; Toast :: message ( $ message , 'success' ) ; return redirect ( ) -> back ( ) ; } catch ( Exception $ e ) { $ message = $ this -> getMessage ( 'messages.something_went_wrong' ) ; Toast :: message ( $ message , 'danger' ) ; return redirect ( ) -> back ( ) ; } } return redirect ( ) -> route ( 'profile' , [ 'message' => $ error ] ) -> withInput ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .