Пример #1
0
 public function update(Request $request)
 {
     $post = $request->all();
     $validator = user::validateUpdateData($post);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator->errors());
     } else {
         $currentpassword = \Auth::user()->password;
         if (\Hash::check($post['password'], $currentpassword)) {
             unset($post['_token'], $post['password']);
             $result = user::where('id', $post['id'])->update($post);
             if ($result > 0) {
                 Flash::success('Profile successfully updated');
             }
             return redirect('admin');
         } else {
             return redirect()->back()->withErrors('Wrong Password');
         }
     }
 }