hasMany(Sanctum::$personalAccessTokenModel); } public function createToken(?string $memo, ?array $ips): NewAccessToken { /** @var \Pterodactyl\Models\ApiKey $token */ $token = $this->tokens()->forceCreate([ 'user_id' => $this->id, 'key_type' => ApiKey::TYPE_ACCOUNT, 'identifier' => ApiKey::generateTokenIdentifier(ApiKey::TYPE_ACCOUNT), 'token' => encrypt($plain = Str::random(ApiKey::KEY_LENGTH)), 'memo' => $memo ?? '', 'allowed_ips' => $ips ?? [], ]); return new NewAccessToken($token, $plain); } }