From 5eb938a0c7728c52a2c2d1355648481ae07df57f Mon Sep 17 00:00:00 2001 From: Luc Wollants Date: Tue, 16 Jul 2024 14:32:41 +0200 Subject: [PATCH 1/2] Revert `isUiTPAS` call to check type only --- app/Domain/Integrations/Models/IntegrationModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Domain/Integrations/Models/IntegrationModel.php b/app/Domain/Integrations/Models/IntegrationModel.php index bb4486f33..f9305ab58 100644 --- a/app/Domain/Integrations/Models/IntegrationModel.php +++ b/app/Domain/Integrations/Models/IntegrationModel.php @@ -97,7 +97,7 @@ public function isWidgets(): bool public function isUiTPAS(): bool { - return $this->type === IntegrationType::UiTPAS->value || $this->type === null; + return $this->type === IntegrationType::UiTPAS->value; } protected static function booted(): void From 05fc98729d222c10d8cf66a9a50e89c5ee4b310f Mon Sep 17 00:00:00 2001 From: Luc Wollants Date: Tue, 16 Jul 2024 14:33:00 +0200 Subject: [PATCH 2/2] Use `canSee` to determine if a model is UiTPAS --- app/Nova/Resources/Integration.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Nova/Resources/Integration.php b/app/Nova/Resources/Integration.php index 5eab9ff96..6dff79361 100644 --- a/app/Nova/Resources/Integration.php +++ b/app/Nova/Resources/Integration.php @@ -209,11 +209,13 @@ function (Text $field, NovaRequest $request, FormData $formData) { $fields[] = HasMany::make('Keycloak client Credentials', 'keycloakClients', KeycloakClient::class); } - if ($this->isUiTPAS()) { - $fields[] = HasMany::make('UDB3 Organizers', 'organizers', Organizer::class); - } - return array_merge($fields, [ + HasMany::make('UDB3 Organizers', 'organizers', Organizer::class) + ->canSee(function () { + /** @var ?IntegrationModel $model */ + $model = $this->model(); + return $model && $model->isUiTPAS(); + }), HasMany::make('Contacts'), HasMany::make('Urls', 'urls', IntegrationUrl::class), HasMany::make('Activity Log'),