Esempio n. 1
0
 /**
  * @param ProfileRequest $request
  * @param int            $id
  *
  * @return mixed
  */
 public function update(ProfileRequest $request, $id)
 {
     $User = User::find($id);
     if ($request->get('name')) {
         $User->name = $request->get('name');
     }
     if ($request->get('email')) {
         $User->email = $request->get('email');
     }
     if ($request->get('password') && env('APP_ENV') != 'homolog') {
         $User->password = bcrypt($request->get('password'));
     }
     if ($User->save()) {
         return Redirect::back()->with('message', 'Data has changed!')->with('message-class', 'success');
     } else {
         return Redirect::back()->with('message', 'Whooops! Could not change data.')->with('message-class', 'error')->withInputs();
     }
 }
 /**
  * @param ProfileRequest $request
  * @param int            $id
  *
  * @return mixed
  */
 public function update(ProfileRequest $request, $id)
 {
     $User = User::find($id);
     if ($request->get('name')) {
         $User->name = $request->get('name');
     }
     if ($request->get('email')) {
         $User->email = $request->get('email');
     }
     if ($request->get('password') && env('APP_ENV') != 'homolog') {
         $User->password = bcrypt($request->get('password'));
     }
     if ($User->save()) {
         $this->flash()->success('Data has changed!');
     } else {
         $this->flash()->error('Whooops! Could not change data.');
     }
     return Redirect::back();
 }