deleteTokens method

Future<bool> deleteTokens(
  1. dynamic userId
)

Delete all the tokens for the user that is currently logged in.

This is useful when a user logs out and you want to delete all of their tokens.

Returns true if the operation was successful.

Implementation

Future<bool> deleteTokens(dynamic userId) async {
  await PersonalAccessToken()
      .query
      .where('tokenable_id', '=', userId)
      .update({'deleted_at': DateTime.now()});

  return true;
}