如何在laravel中设置重置密码的API

时间:2018-06-07 07:39:04

标签: laravel

如何在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]));
    }
}

0 个答案:

没有答案