validate(request(), [ 'email' => 'required|email', ], [ 'required' => ':attribute jest wymagany.', 'email' => 'Niepoprawny adres e-mail.' ]); $request = request(); $user = DB::table('users')->where('email', '=', $request->email) ->first(); if($user){ $password = str_random(10); User::where('email', '=', $request->email) ->update(['password' => Hash::make($password)]); // this will also update the record //$user->password = $password; //$user->save(); Mail::send('emails.passwordReset', compact('password'), function($message) { $message->to(Input::get('email'))->subject('Zmiana hasła'); }); } return redirect()->to('/login')->with('success','Jeśli podany adres email jest poprawny, nowe hasło zostało wysłane'); } }