jeudi 18 juin 2020

Column not found: 1054 Unknown column 'token' if I have put token

When I have a put value of token in postman, that column not found

My question: how can i solve this problem?

Column not found: 1054 Unknown column 'DGZUMKiVwqISeeHJAfe8xZcuQz7uQ3YvmEdjfdcgyefrbduchSJ8hyApX2bOJWf8O7R7IbmYs1c' in 'where clause' (SQL: select * from password_resets where (DGZUMKiVwqISeeHJAfe8xZcuQz7uQ3YvmESJ8hyApX2bOJWf8O7R7IbmYs1c is null and plz@gmail.com is null) limit 1)",

My Controller:

public function reset(Request $request)
{
    $this->validate($request,[

        'email' => 'required|string|email',
        'password' => 'required|string|confirmed',
        'token' => 'required',
        'created_at' => Carbon::now(),
    ]);

    $passwordreset = PasswordReset::where([
        ['token' => $request->token],
        ['email' => $request->email]
    ])->first();

    if( $passwordreset)
        return response()->json([
            'message' => 'This password reset is invalid'
        ], 402);

    $user = User::where('email', $passwordreset->email)->first();

    if($user)
        return response()->json([
            'message' => 'we cant find user email addrsss!'
        ], 404); 

    $user->password = bcrypt($request->password);
    $user->save();

    $passwordreset->delete();
    $user->notify(new PasswordResetSuccess($passwordreset));

    return response()->json($user);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire