Skip to content

Commit

Permalink
Merge pull request #286 from lara-zeus/fix-visabilty
Browse files Browse the repository at this point in the history
fix visibility with live select
  • Loading branch information
atmonshi authored May 27, 2024
2 parents 393052b + 5be8ff3 commit d003653
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Concerns/HasOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,15 @@ public static function visibility(?array $getFields = []): Accordion
Select::make('options.visibility.fieldID')
->label(__('show when the field:'))
->live()
->searchable(false)
->visible(fn (Get $get): bool => ! empty($get('options.visibility.active')))
->required(fn (Get $get): bool => ! empty($get('options.visibility.active')))
->options(optional($getFields)->pluck('name', 'id')),

Select::make('options.visibility.values')
->label(__('has the value:'))
->live()
->searchable(false)
->required(fn (Get $get): bool => ! empty($get('options.visibility.fieldID')))
->visible(fn (Get $get): bool => ! empty($get('options.visibility.fieldID')))
->options(function (Get $get) use ($getFields) {
Expand Down

0 comments on commit d003653

Please sign in to comment.