如何在laravel中设置重置和忘记密码的API
public function getResetToken(Request $request)
{
$this->validate($request, ['email' => 'required|email']);
if ($request->wantsJson()) {
$user = User::where('email', $request->input('email'))->first();
if (!$user) {
return response()->json(Json::response(null, trans('passwords.user')), 400);
}
$token = $this->broker()->createToken($user);
return response()->json(Json::response(['token' => $token]));
}
}