app/Http/Controllers/UserController.php
/**
	 * Update the specified resource in storage.
	 *
	 * @param  int  $id
	 * @return Response
	 */
Update the specified resource in storage.
@param  int  $id
@return Response
Update the specified resource in storage . @param int $id @return Response
public function update(Request $request)
	{
		$validator = \Validator::make($request->all(), array(
			'loc' => 'required'         
			));
		if ($validator->fails())
		{
			$error="Location is required";
		}
		else{
			if( session()->has('email')){
				$id = session()->get('id');
				$content['autorun_location']        = $request->loc;
				\App\User::find($id)->update($content);
				session(['autorun_location' =>$content['autorun_location']  ]);
				$message = $this->getMessage('messages.success');
				Toast::message($message, 'success');
		        return redirect()->route('profile');
		 	}else
		 	{
		 		$error = "Session expired. Please login to continue";
		 	}
	 	}
	 	$message = $error;
		Toast::message($message, 'danger');
	 	return redirect()->route('profile')->withInput();
	}
public function update ( Request $ request ) { $ validator = \ Validator :: make ( $ request -> all ( ) , array ( 'loc' => 'required' ) ) ; if ( $ validator -> fails ( ) ) { $ error = " Location is required " ; } else { if ( session ( ) -> has ( 'email' ) ) { $ id = session ( ) -> get ( 'id' ) ; $ content [ 'autorun_location' ] = $ request -> loc ; \ App \ User :: find ( $ id ) -> update ( $ content ) ; session ( [ 'autorun_location' => $ content [ 'autorun_location' ] ] ) ; $ message = $ this -> getMessage ( 'messages.success' ) ; Toast :: message ( $ message , 'success' ) ; return redirect ( ) -> route ( 'profile' ) ; } else { $ error = " Session expired. Please login to continue " ; } } $ message = $ error ; Toast :: message ( $ message , 'danger' ) ; return redirect ( ) -> route ( 'profile' ) -> withInput ( ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//Validations //Process when validations pass