Skip to content

Commit

Permalink
Allow only key visibility v2 when creating UiTPAS integration in backend
Browse files Browse the repository at this point in the history
  • Loading branch information
LucWollants committed Jul 26, 2024
1 parent 1221815 commit fe04173
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions app/Nova/Resources/Integration.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,24 @@ public function fields(NovaRequest $request): array
Select::make('Key Visibility')
->filterable()
->sortable()
->options([
KeyVisibility::v1->value => KeyVisibility::v1->name,
KeyVisibility::v2->value => KeyVisibility::v2->name,
KeyVisibility::all->value => KeyVisibility::all->name,
])
->rules('required'),
->required()
->dependsOn(
['type'],
function (Select $field, NovaRequest $request, FormData $formData) {
if ($formData->string('type')->toString() !== IntegrationType::UiTPAS->value) {
$field->options([
KeyVisibility::v1->value => KeyVisibility::v1->name,
KeyVisibility::v2->value => KeyVisibility::v2->name,
KeyVisibility::all->value => KeyVisibility::all->name,
]);
return;
}

$field->options([
KeyVisibility::v2->value => KeyVisibility::v2->name,
]);
}
),

Text::make('Description')
->rules('required', 'max:255')
Expand Down

0 comments on commit fe04173

Please sign in to comment.