I am making APIs in lumen . For login I am returning some data along with the user. But the problem is in the user object the api-token is not as exact it is stored in database. The special characters in the string is being preceded by a "\". so when the user sending this api token returned in the login method the token is not matching in the middleware for those extra '\' how to solve this. my login function
public function login(Request $request){
$this->validate($request,[
'password' => 'required|string|min:6|max:255',
'email' => 'required|string|email|max:255',
]);
try{
$user =User::where([['email' , '=' , $request->email],['password' , '=' , $request->password]])->first();
if($user){
return response(($user),200);
}
}catch(Exception $exception){
$response = [
'status' => 'Internal Server Error',
'exception' =>$exception
];
return json_encode($response);
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire