mercredi 24 juin 2020

why is not find user email to database?

public function create(Request $request){

$this->validate($request, [
 'email' => 'required|email',

]);

   $user = user::where('email',$request->email)->first();      
     if ($user)
   return response()->json([
       'message' => 'We can not find a user with that e-mail address.'
   ], 404);
   
   
   $passwordReset = PasswordReset::updateOrCreate(
  
   [
        //'email' =>$user->email,
        'email'=>$request->email,
        'token' => str_random(60)
    ]
   
);

if ($user && $passwordReset)
$user->notify(
    new PasswordResetRequest($passwordReset->token)
);       
 return response()->json([
'message' => 'We have e-mailed your password reset link!'

]);

}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire