deleteCurrentToken method

Future<bool> deleteCurrentToken(
  1. String token
)

Delete the current token for the user that is currently logged in.

This function marks the current token as deleted by setting the deleted_at field to the current time in the database. This operation helps to effectively invalidate the token.

Returns a Future that resolves to true if the operation was successful.

Implementation

Future<bool> deleteCurrentToken(String token) async {
  await PersonalAccessToken()
      .query
      .where('token', '=', md5.convert(utf8.encode(token)))
      .update({'deleted_at': DateTime.now()});
  return true;
}