Postingan lainnya
Laravel kirim email Unable to resolve NULL driver for [Illuminate\Mail\TransportManager]
Ada yang tau ini kenapa
image.png
public function sendResets(Request $request)
{
$cekEmail = User::where('email', $request->email)->first();
if ($cekEmail) {
$datapw = new PasswordReset;
$datapw->email = $request->email;
$datapw->token = Str::random(6);
if ($datapw->save()) {
try{
Mail::send('email-reset', ['token' => $datapw->token], function ($message) use ($request)
{
$message->subject('Reset Password');
$message->from('email.sendmail@gmail.com', 'Reset Password');
$message->to($request->email);
});
}
catch (Exception $e){
return response (['status' => false,'errors' => $e->getMessage()]);
}
return response()->json(['msg'=>'Email terkirim']);
}else {
return response()->json(['msg'=>'Email tidak terkirim']);
}
}else {
return response()->json(['msg'=>'Email tidak terdaftar']);
}
}
0
Belum ada Jawaban. Jadi yang pertama Jawaban
Login untuk ikut Jawaban